@shijiu/jsview-vue-samples 2.2.35 → 2.2.201

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/BakeViewDemo/AnimatePic.vue +93 -0
  2. package/BakeViewDemo/App.vue +109 -0
  3. package/ClickDivDemo/App.vue +150 -0
  4. package/CoupletsTest/widget/Banger/Maroon.vue +4 -6
  5. package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -42
  6. package/CustomShader/App.vue +157 -0
  7. package/CustomShader/gaussianBlur.glsl +27 -0
  8. package/CustomShader/pageFlip.glsl +40 -0
  9. package/CustomShader/sdf.glsl +22 -0
  10. package/CustomShader/test.glsl +8 -0
  11. package/CustomShader/vortex.glsl +38 -0
  12. package/DemoHomepage/App.vue +36 -27
  13. package/DemoHomepage/components/Dialog.vue +37 -11
  14. package/DemoHomepage/components/TabFrame.vue +8 -1
  15. package/DemoHomepage/router.js +71 -26
  16. package/DemoHomepage/views/Homepage.vue +30 -13
  17. package/DriftScopeTest/App.vue +128 -0
  18. package/FocusMoveStyle/App.vue +21 -4
  19. package/FocusMoveStyle/FoldableItem.vue +39 -12
  20. package/FreeMove/App.vue +62 -64
  21. package/FreeMoveChildAttract/App.vue +105 -0
  22. package/FreeMoveLink/App.vue +55 -0
  23. package/FreeMoveResize/App.vue +102 -0
  24. package/ImpactStop/App.vue +45 -45
  25. package/LongImage/App.vue +1 -2
  26. package/LongText/App.vue +3 -5
  27. package/LongText/LongTextScroll.vue +83 -38
  28. package/LongText/Scroll.vue +28 -9
  29. package/LongTextLatex/App.vue +93 -0
  30. package/LongTextLatex/Button.vue +50 -0
  31. package/LongTextLatex/ButtonItem.vue +44 -0
  32. package/LongTextLatex/LongTextScroll.vue +189 -0
  33. package/LongTextLatex/Scroll.vue +14 -0
  34. package/MetroWidgetDemos/MassiveItems/App.vue +87 -0
  35. package/MetroWidgetDemos/MassiveItems/ContentItem.vue +388 -0
  36. package/MetroWidgetDemos/MassiveItems/Item.vue +203 -0
  37. package/MetroWidgetDemos/MassiveItems/WidgetItem.vue +101 -0
  38. package/MetroWidgetDemos/MassiveItems/data.js +17 -0
  39. package/MetroWidgetDemos/PingPong/AppPage.vue +19 -9
  40. package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
  41. package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
  42. package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
  43. package/MetroWidgetDemos/routeList.js +6 -0
  44. package/SceneTransition/JsvSceneTransition.vue +30 -42
  45. package/ScrollBoxTest/App.vue +109 -0
  46. package/ScrollBoxTest/ClipBar.vue +153 -0
  47. package/ScrollBoxTest/DrawCircle.ts +25 -0
  48. package/ScrollBoxTest/NinePatchBar.vue +187 -0
  49. package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
  50. package/ScrollBoxTest/SizeDivBar.vue +138 -0
  51. package/TestNativeSharedView/App.vue +166 -73
  52. package/TextureAnimation/App2.vue +17 -6
  53. package/TombSweepingDayTest/Raining/Rain.vue +8 -8
  54. package/TombSweepingDayTest/Raining/RainScene.vue +36 -24
  55. package/package.json +1 -1
  56. package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
@@ -0,0 +1,40 @@
1
+ #define pi 3.14159265359
2
+ #define radius .1
3
+
4
+ float fastAsin(float x) {
5
+ float x2 = x * x;
6
+ float x3 = x2 * x;
7
+ float x5 = x3 * x2;
8
+ float x7 = x5 * x2;
9
+ return x + (1.0 / 6.0) * x3 + (3.0 / 40.0) * x5 + (5.0 / 112.0) * x7;
10
+ }
11
+
12
+ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
13
+ vec2 aspect = iResolution.xy / iResolution.y;
14
+ vec2 uv = fragCoord * aspect / iResolution.xy;
15
+ vec2 anchor = aspect;
16
+ vec2 mouse = anchor - abs(sin(iTime / 2.)) * anchor;
17
+ vec2 mouseDir = normalize(anchor - mouse);
18
+ vec2 origin = mouse - mouseDir * mouse.x / abs(mouseDir.x);
19
+ float mouseDist = length(mouse - origin);
20
+
21
+ float proj = dot(uv - origin, mouseDir);
22
+ float dist = proj - mouseDist;
23
+ vec2 linePoint = uv - dist * mouseDir;
24
+ if(dist > radius) {
25
+ fragColor = vec4(0.0, 0.5, 0.6, 1.0);
26
+ fragColor.rgb *= pow(clamp(dist - radius, 0., 1.) * 1.5, .2);
27
+ } else if(dist >= 0.) {
28
+ // map to cylinder point
29
+ float theta = fastAsin(dist / radius);
30
+ vec2 p2 = linePoint + mouseDir * (pi - theta) * radius;
31
+ vec2 p1 = linePoint + mouseDir * theta * radius;
32
+ uv = (p2.x <= aspect.x && p2.y <= aspect.y && p2.x > 0. && p2.y > 0.) ? p2 : p1;
33
+ fragColor = jsvTexture2D(iChannel0, uv / aspect);
34
+ fragColor.rgb *= pow(clamp((radius - dist) / radius, 0., 1.), .2);
35
+ } else {
36
+ vec2 p = linePoint + mouseDir * (abs(dist) + pi * radius);
37
+ uv = (p.x <= aspect.x && p.y <= aspect.y && p.x > 0. && p.y > 0.) ? p : uv;
38
+ fragColor = jsvTexture2D(iChannel0, uv / aspect);
39
+ }
40
+ }
@@ -0,0 +1,22 @@
1
+ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
2
+ // Normalized pixel coordinates (from 0 to 1)
3
+ vec2 aspect = iResolution.xy / iResolution.y;
4
+ vec2 originUv = fragCoord / iResolution.xy;
5
+ vec2 uv = 2. * (originUv - 0.5) * aspect;
6
+
7
+ vec2 sum = vec2(0., 0.); // r, g
8
+
9
+ float modTime = iTime - (60. * floor(iTime / 60.));
10
+ float time = 50. * abs(fract(modTime / 30.) - .5);
11
+
12
+ for(int i = 10; i < 13; i++) {
13
+ vec2 pos = uv * 40. + vec2(sin(time / 3. * float(i) / 2.), cos(time / 3. * float(i) / 3.)) * 10. * (1.0 + float(i) / 10.);
14
+ float dist = 1. / length(pos) * 6.;
15
+ sum += dist;
16
+ }
17
+ sum *= 0.5;
18
+ // sum.x = clamp(sum.x, 0., 1.);
19
+ // sum.x = step(.5, sum.x);
20
+ // fragColor = vec4(.1, sum.x, sum.x, sum.x);
21
+ fragColor = sum.x > 0.5 ? jsvTexture2D(iChannel0, originUv) : vec4(0.);
22
+ }
@@ -0,0 +1,8 @@
1
+ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
2
+ vec2 uv = fragCoord / iResolution.xy;
3
+ if (uv.x < .1 && uv.y < .1) {
4
+ fragColor = vec4(1.);
5
+ } else {
6
+ fragColor = vec4(0.);
7
+ }
8
+ }
@@ -0,0 +1,38 @@
1
+ #define RANGE 6.
2
+ #define SPEED .5
3
+ #define STRENGTH 6.
4
+
5
+ mat2 rotate(float a) {
6
+ float s = sin(a);
7
+ float c = cos(a);
8
+ return mat2(c, -s, s, c);
9
+ }
10
+
11
+ void mainImage(out vec4 fragColor, vec2 coord) {
12
+ /** mediump精度10bit, 直接使用0-1的uv, 小值的normalize()会有精度问题, 导致异常大的结果; 但乘1920x1080又会有大值的问题, 所以选取16x9 */
13
+ vec2 aspect = (iResolution.xy / iResolution.y) * 9.;
14
+ vec2 center = 0.5 * aspect;
15
+
16
+ vec2 uv = coord / iResolution.xy * aspect;
17
+ uv -= center;
18
+
19
+ float d = length(uv);
20
+ float progress = sin(iTime * SPEED);
21
+
22
+ //vortex
23
+ float cTime = STRENGTH * progress;
24
+ d = smoothstep(0., RANGE, RANGE - d) * cTime;
25
+ uv *= rotate(d);
26
+
27
+ //shrink
28
+ float edge = aspect.y * abs(progress);
29
+ uv = uv + normalize(uv) * edge;
30
+
31
+ uv += center;
32
+ uv /= aspect;
33
+ if(uv.x > 1. || uv.y > 1. || uv.x < 0. || uv.y < 0.) {
34
+ fragColor = vec4(0.0, 0.5, 0.6, 1.);
35
+ } else {
36
+ fragColor = jsvTexture2D(iChannel0, uv);
37
+ }
38
+ }
@@ -7,15 +7,21 @@
7
7
  -->
8
8
  <script setup>
9
9
  import { shallowRef, onMounted, onUnmounted } from "vue";
10
- import { JsvPreload, buildPreloadInfo, jJsvRuntimeBridge, JsvFocusBlock, useFocusHub } from "jsview";
10
+ import {
11
+ JsvPreload,
12
+ buildPreloadInfo,
13
+ jJsvRuntimeBridge,
14
+ JsvFocusBlock,
15
+ useFocusHub,
16
+ } from "jsview";
11
17
  import { useRouter } from "vue-router";
12
- import { setDataUrl, getDataUrl } from "../CommonUtils/ResourceData.js"
13
- import { getSearchQuery } from "../CommonUtils/getSearchQuery.js"
18
+ import { setDataUrl, getDataUrl } from "../CommonUtils/ResourceData.js";
19
+ import { getSearchQuery } from "../CommonUtils/getSearchQuery.js";
14
20
 
15
- let DemoResourceBase=shallowRef("")
21
+ let DemoResourceBase = shallowRef("");
16
22
  let backgroundImageUrl = shallowRef(null);
17
23
 
18
- let preloadInfo = shallowRef([]);
24
+ // let preloadInfo = shallowRef([]);
19
25
 
20
26
  window.DebugFocusHub = useFocusHub();
21
27
 
@@ -41,52 +47,56 @@ let testKeepAliveModeText = shallowRef(1);
41
47
  let testKeepAliveTimer = -1;
42
48
 
43
49
  //解析url
44
- let query = getSearchQuery(window.location.href, undefined, 0)
50
+ let query = getSearchQuery(window.location.href, undefined, 0);
45
51
  if (query.DemoResourceBase) {
46
- setDataUrl(query.DemoResourceBase)
52
+ setDataUrl(query.DemoResourceBase);
47
53
  //无网络环境下使用
48
- DemoResourceBase.value = getDataUrl()
54
+ DemoResourceBase.value = getDataUrl();
49
55
  }
50
56
  onMounted(() => {
51
57
  console.log("simulate async get background url");
52
58
  setTimeout(() => {
53
59
  console.log("simulate background url got");
54
- backgroundImageUrl.value = DemoResourceBase.value ? `${DemoResourceBase.value}/BackgroundLongmao.jpg`
55
- :
56
- "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg";
57
- preloadInfo.value = [buildPreloadInfo(backgroundImageUrl.value)];
60
+ backgroundImageUrl.value = DemoResourceBase.value
61
+ ? `${DemoResourceBase.value}/BackgroundLongmao.jpg`
62
+ : "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg";
63
+ // preloadInfo.value = [buildPreloadInfo(backgroundImageUrl.value)];
58
64
  }, 0);
59
65
 
60
66
  console.log("start homepage interval");
61
- testKeepAliveTimer = setInterval(()=>{
67
+ testKeepAliveTimer = setInterval(() => {
62
68
  testKeepAliveModeText.value++;
63
- }, 1000)
69
+ }, 1000);
64
70
  });
65
71
 
66
- onUnmounted(()=>{
72
+ onUnmounted(() => {
67
73
  if (testKeepAliveTimer > 0) {
68
74
  console.log("remove homepage interval");
69
75
  clearInterval(testKeepAliveTimer);
70
76
  testKeepAliveTimer = -1;
71
77
  }
72
- })
73
-
78
+ });
74
79
  </script>
75
80
 
76
81
  <template>
77
82
  <div>
78
- <jsv-preload :key="backgroundImageUrl" :preloadList="preloadInfo" :onPreloadDone="_onPreloadDone" />
79
- <div :style="{
80
- width: 1280,
81
- height: 720,
82
- backgroundImage: backgroundImageUrl,
83
- }" />
83
+ <!-- <jsv-preload :key="backgroundImageUrl" :preloadList="preloadInfo" :onPreloadDone="_onPreloadDone" /> -->
84
+ <img
85
+ :src="backgroundImageUrl"
86
+ :style="{
87
+ width: 1280,
88
+ height: 720,
89
+ }"
90
+ @load="_onPreloadDone"
91
+ />
84
92
  <div class="TestKeepAliveDiv">
85
93
  {{ "刷新:" + testKeepAliveModeText }}
86
94
  </div>
87
- <jsv-focus-block :onAction="{
88
- onKeyDown: _OnKeyDown
89
- }">
95
+ <jsv-focus-block
96
+ :onAction="{
97
+ onKeyDown: _OnKeyDown,
98
+ }"
99
+ >
90
100
  <router-view v-slot="{ Component, route }">
91
101
  <keep-alive>
92
102
  <component v-if="route.meta.keepAlive" :is="Component" />
@@ -107,5 +117,4 @@ onUnmounted(()=>{
107
117
  line-height: 30;
108
118
  color: #eb20c6;
109
119
  }
110
-
111
120
  </style>
@@ -1,11 +1,20 @@
1
1
  <script setup>
2
- import { shallowRef } from "vue"
2
+ import { shallowRef, watchEffect } from "vue";
3
+ import { useFocusHub } from "jsview";
3
4
  const props = defineProps({
4
5
  name: String,
5
6
  onAction: Function,
6
- })
7
+ focused: Boolean,
8
+ });
7
9
 
8
- let focusId = shallowRef(0)
10
+ let focusId = shallowRef(0);
11
+
12
+ const focusHub = useFocusHub();
13
+ watchEffect(() => {
14
+ if (props.focused) {
15
+ focusHub.setFocus(props.name);
16
+ }
17
+ });
9
18
 
10
19
  const onKeyDown = (ev) => {
11
20
  switch (ev.keyCode) {
@@ -29,25 +38,42 @@ const onKeyDown = (ev) => {
29
38
  default:
30
39
  }
31
40
  return true;
32
- }
41
+ };
33
42
  const actionDefines = {
34
- onKeyDown
35
- }
43
+ onKeyDown,
44
+ };
45
+
46
+ const funcDialogOuterClick = () => {
47
+ console.log("Clicked on dialog outer");
48
+ props.onAction("back");
49
+ };
50
+
51
+ const funcDialogBackClick = () => {
52
+ console.log("Clicked on dialog back");
53
+ };
54
+
55
+ const funcDialogOKClick = () => {
56
+ props.onAction("ok");
57
+ };
36
58
 
59
+ const funcDialogNGClick = () => {
60
+ props.onAction("cancel");
61
+ };
37
62
  </script>
38
63
 
39
64
  <template>
40
- <jsv-focus-block autoFocus :name="props.name" :onAction="actionDefines">
65
+ <jsv-focus-block :name="props.name" :onAction="actionDefines">
66
+ <div :style="{ width: 1280, height: 720 }" @click="funcDialogOuterClick" />
41
67
  <div :style="{ top: 200, left: 465 }">
42
- <div class="background"></div>
68
+ <div class="background" @click="funcDialogBackClick"></div>
43
69
  <div class="message">是否退出</div>
44
70
  <div :style="{ top: 120, left: 30 }">
45
71
  <div v-if="focusId == 0" class="focus"></div>
46
- <div class="normal">确定</div>
72
+ <div class="normal" @click="funcDialogOKClick">确定</div>
47
73
  </div>
48
74
  <div :style="{ top: 120, left: 220 }">
49
75
  <div v-if="focusId == 1" class="focus"></div>
50
- <div class="normal">取消</div>
76
+ <div class="normal" @click="funcDialogNGClick">取消</div>
51
77
  </div>
52
78
  </div>
53
79
  </jsv-focus-block>
@@ -86,4 +112,4 @@ const actionDefines = {
86
112
  font-size: 40;
87
113
  text-align: center;
88
114
  }
89
- </style>
115
+ </style>
@@ -46,10 +46,17 @@ const data = [
46
46
  {
47
47
  width: 200,
48
48
  height: 50,
49
- name: "游戏实例",
49
+ name: "触控",
50
50
  focusable: true,
51
51
  id: 3,
52
52
  },
53
+ {
54
+ width: 200,
55
+ height: 50,
56
+ name: "游戏实例",
57
+ focusable: true,
58
+ id: 4,
59
+ },
53
60
  ];
54
61
  const direction = VERTICAL;
55
62
  </script>
@@ -16,10 +16,15 @@ let routeList = [
16
16
  path: '/feature/Basic',
17
17
  component: () => import('jsview-vue-samples/Basic/App.vue'),
18
18
  },
19
+ // {
20
+ // name: 'FreeMoveResize',
21
+ // path: '/feature/FreeMoveResize',
22
+ // component: () => import('jsview-vue-samples/FreeMoveResize/App.vue'),
23
+ // },
19
24
  {
20
- name: '清明节组件效果测试',
21
- path: '/Operations/TombSweepingDayTest',
22
- component: () => import('jsview-vue-samples/TombSweepingDayTest/App.vue'),
25
+ name: 'div快照功能',
26
+ path: '/feature/BakeViewDemo',
27
+ component: () => import('jsview-vue-samples/BakeViewDemo/App.vue'),
23
28
  },
24
29
  {
25
30
  name: 'FlexDemo',
@@ -73,11 +78,6 @@ let routeList = [
73
78
  path: '/feature/GridDemo',
74
79
  component: () => import('jsview-vue-samples/GridDemo/App.vue'),
75
80
  },
76
- {
77
- name: '.9图焦点框漂移',
78
- path: '/Operations/NinePatchDemo',
79
- component: () => import('jsview-vue-samples/NinePatchDemo/App.vue'),
80
- },
81
81
  {
82
82
  name: '有命名空间的焦点切换',
83
83
  path: '/feature/BasicFocusControl',
@@ -104,25 +104,15 @@ let routeList = [
104
104
  path: '/feature/TextureSize',
105
105
  component: () => import('jsview-vue-samples/TextureSize/App.vue'),
106
106
  },
107
- {
108
- name: '动图',
109
- path: '/Operations/AnimPicture',
110
- component: () => import('jsview-vue-samples/AnimPicture/App.vue'),
111
- },
112
- {
113
- name: '粒子效果',
114
- path: '/Operations/SprayView',
115
- component: () => import('jsview-vue-samples/SprayView/App.vue'),
116
- },
117
107
  {
118
108
  name: '长文字',
119
109
  path: '/feature/LongText',
120
110
  component: () => import('jsview-vue-samples/LongText/App.vue'),
121
111
  },
122
112
  {
123
- name: '长图片',
124
- path: '/Operations/LongImage',
125
- component: () => import('jsview-vue-samples/LongImage/App.vue'),
113
+ name: '长文字Latex',
114
+ path: '/feature/LongTextLatex',
115
+ component: () => import('jsview-vue-samples/LongTextLatex/App.vue'),
126
116
  },
127
117
  {
128
118
  name: '二维码',
@@ -160,6 +150,31 @@ let routeList = [
160
150
  path: '/feature/Input',
161
151
  component: () => import('jsview-vue-samples/Input/App.vue'),
162
152
  },
153
+ {
154
+ name: '情景主题效果:雨',
155
+ path: '/Operations/TombSweepingDayTest',
156
+ component: () => import('jsview-vue-samples/TombSweepingDayTest/App.vue'),
157
+ },
158
+ {
159
+ name: '.9图焦点框漂移',
160
+ path: '/Operations/NinePatchDemo',
161
+ component: () => import('jsview-vue-samples/NinePatchDemo/App.vue'),
162
+ },
163
+ {
164
+ name: '动图',
165
+ path: '/Operations/AnimPicture',
166
+ component: () => import('jsview-vue-samples/AnimPicture/App.vue'),
167
+ },
168
+ {
169
+ name: '粒子效果',
170
+ path: '/Operations/SprayView',
171
+ component: () => import('jsview-vue-samples/SprayView/App.vue'),
172
+ },
173
+ {
174
+ name: '长图片',
175
+ path: '/Operations/LongImage',
176
+ component: () => import('jsview-vue-samples/LongImage/App.vue'),
177
+ },
163
178
  {
164
179
  name: '拼图demo',
165
180
  path: '/Operations/MaskClip',
@@ -306,11 +321,6 @@ let routeList = [
306
321
  path: '/feature/LatexFormula',
307
322
  component: () => import('jsview-vue-samples/LatexFormula/App.vue'),
308
323
  },
309
- {
310
- name: '触控示例',
311
- path: '/feature/TouchWidget',
312
- component: () => import('jsview-vue-samples/TouchWidget/App.vue'),
313
- },
314
324
  {
315
325
  name: 'Swiper3dTest',
316
326
  path: '/Operations/Swiper3D',
@@ -331,6 +341,41 @@ let routeList = [
331
341
  path: '/Operations/SceneTransition',
332
342
  component: () => import('jsview-vue-samples/SceneTransition/App.vue'),
333
343
  },
344
+ {
345
+ name: '点击Div',
346
+ path: '/touch/ClickDivDemo',
347
+ component: () => import('jsview-vue-samples/ClickDivDemo/App.vue'),
348
+ },
349
+ {
350
+ name: '触控示例',
351
+ path: '/touch/TouchWidget',
352
+ component: () => import('jsview-vue-samples/TouchWidget/App.vue'),
353
+ },
354
+ // {
355
+ // name: 'FreeMove触控磁吸',
356
+ // path: '/touch/FreeMoveChildAttract',
357
+ // component: () => import('jsview-vue-samples/FreeMoveChildAttract/App.vue'),
358
+ // },
359
+ // {
360
+ // name: 'FreeMoveLink',
361
+ // path: '/touch/FreeMoveLink',
362
+ // component: () => import('jsview-vue-samples/FreeMoveLink/App.vue'),
363
+ // },
364
+ {
365
+ name: '可拖拽进度条',
366
+ path: '/touch/ScrollBoxTest',
367
+ component: () => import('jsview-vue-samples/ScrollBoxTest/App.vue'),
368
+ },
369
+ // {
370
+ // name: '透视镜效果样例',
371
+ // path: '/Operations/DriftScopeTest',
372
+ // component: () => import('jsview-vue-samples/DriftScopeTest/App.vue'),
373
+ // },
374
+ {
375
+ name: '自定义shader',
376
+ path: '/Operations/CustomShader',
377
+ component: () => import('jsview-vue-samples/CustomShader/App.vue'),
378
+ },
334
379
  ];
335
380
 
336
381
  //添加MetroWidget demo
@@ -6,15 +6,16 @@ import TabFrame from "../components/TabFrame.vue";
6
6
  import BodyFrame from "../components/BodyFrame.vue";
7
7
  import Dialog from "../components/Dialog.vue";
8
8
 
9
- const isDevelopment = process.env.NODE_ENV !== 'production';
9
+ const isDevelopment = process.env.NODE_ENV !== "production";
10
10
 
11
11
  const colorTemplete = ["#89BEB2", "#C9BA83", "#DED38C", "#DE9C53"];
12
12
 
13
13
  //功能实例 MetroWidgetData 首页/运营 游戏实例
14
14
  const featureData = [];
15
15
  const metroWidgetData = [];
16
- const operationsData=[];
17
- const gameData=[]
16
+ const operationsData = [];
17
+ const gameData = [];
18
+ const touchTestData = [];
18
19
 
19
20
  const routeList = useRouter().getRoutes();
20
21
  for (let item of routeList) {
@@ -25,23 +26,35 @@ for (let item of routeList) {
25
26
  height: 100,
26
27
  focusable: true,
27
28
  };
28
- if (item.path.indexOf("feature") >= 0) {
29
+ if (item.path.indexOf("/feature/") >= 0) {
29
30
  obj.backgroundColor = colorTemplete[featureData.length % 4];
30
31
  featureData.push(obj);
31
- } else if (item.path.indexOf("metroWidget") >= 0) {
32
+ } else if (item.path.indexOf("/metroWidget/") >= 0) {
32
33
  obj.backgroundColor = colorTemplete[metroWidgetData.length % 4];
33
34
  metroWidgetData.push(obj);
34
- }else if (item.path.indexOf("Operations") >= 0) {
35
+ } else if (item.path.indexOf("/Operations/") >= 0) {
35
36
  obj.backgroundColor = colorTemplete[operationsData.length % 4];
36
37
  operationsData.push(obj);
37
- }else if (item.path.indexOf("Game") >= 0) {
38
+ } else if (item.path.indexOf("/Game/") >= 0) {
38
39
  obj.backgroundColor = colorTemplete[gameData.length % 4];
39
40
  gameData.push(obj);
41
+ } else if (item.path.indexOf("/touch/") >= 0) {
42
+ obj.backgroundColor = colorTemplete[touchTestData.length % 4];
43
+ touchTestData.push(obj);
40
44
  }
41
45
  }
42
- const dataList = [featureData, metroWidgetData,operationsData,gameData];
43
-
46
+ const dataList = [
47
+ featureData,
48
+ metroWidgetData,
49
+ operationsData,
50
+ touchTestData,
51
+ gameData,
52
+ ];
53
+
54
+ // 控制v-show
55
+ // 不用v-if是为了测试已存在的view从hide到show,并挡住其他view,是否touch判断层级正常
44
56
  let showExitDialog = shallowRef(false);
57
+
45
58
  let contentData = shallowRef(dataList[0]);
46
59
  let tabId = shallowRef(0);
47
60
 
@@ -108,7 +121,7 @@ let tabItemClick = (id, data) => {
108
121
  tabId.value = data.id;
109
122
  contentData.value = dataList[data.id];
110
123
  }
111
- }
124
+ };
112
125
 
113
126
  let onDialogAction = (msg) => {
114
127
  showExitDialog.value = false;
@@ -141,7 +154,6 @@ onActivated(() => {
141
154
  onDeactivated(() => {
142
155
  focusNameOfDeactive = focusHub.getDeactivedPageFocus();
143
156
  });
144
-
145
157
  </script>
146
158
 
147
159
  <template>
@@ -149,7 +161,11 @@ onDeactivated(() => {
149
161
  <div class="address">
150
162
  {{ address }}
151
163
  </div>
152
- <div class="logo">{{ 'JsView-Vue3 (Vite3) [' + (isDevelopment ? 'Debug' : 'Release') + ']' }}</div>
164
+ <div class="logo">
165
+ {{
166
+ "JsView-Vue3 (Vite3) [" + (isDevelopment ? "Debug" : "Release") + "]"
167
+ }}
168
+ </div>
153
169
 
154
170
  <jsv-focus-block
155
171
  autoFocus
@@ -183,9 +199,10 @@ onDeactivated(() => {
183
199
  </div>
184
200
 
185
201
  <Dialog
186
- v-if="showExitDialog"
202
+ v-show="showExitDialog"
187
203
  :name="name + '/exitDialog'"
188
204
  :onAction="onDialogAction"
205
+ :focused="showExitDialog"
189
206
  ></Dialog>
190
207
  </jsv-focus-block>
191
208
  </div>