@shijiu/jsview-vue 1.9.650 → 1.9.719

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 (157) hide show
  1. package/package.json +7 -18
  2. package/samples/AnimPicture/App.vue +5 -5
  3. package/samples/Basic/components/div/DivLayout.vue +1 -1
  4. package/samples/Basic/components/text/TextOverflow.vue +10 -5
  5. package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
  6. package/samples/Collision/App.vue +452 -0
  7. package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
  8. package/samples/DemoHomepage/router.js +21 -1
  9. package/samples/DemoHomepage/views/Homepage.vue +3 -7
  10. package/samples/FilterDemo/App.vue +1 -1
  11. package/samples/FlipCard/App.vue +2 -2
  12. package/samples/FlipCard/FlipCard.vue +2 -2
  13. package/samples/GridDemo/App.vue +3 -3
  14. package/samples/GridDemo/ButtonBlock.vue +2 -2
  15. package/samples/GridDemo/FocusItem.vue +2 -2
  16. package/samples/GridDemo/Item.vue +1 -1
  17. package/samples/HashHistory/App.vue +10 -3
  18. package/samples/HashHistory/components/Item.vue +1 -1
  19. package/samples/ImpactStop/App.vue +435 -0
  20. package/samples/Input/App.vue +8 -17
  21. package/samples/Input/InputPanel.vue +19 -12
  22. package/samples/LongImage/Button.vue +1 -1
  23. package/samples/LongImage/ButtonItem.vue +1 -1
  24. package/samples/LongImage/LongImageScroll.vue +2 -2
  25. package/samples/LongText/App.vue +1 -1
  26. package/samples/LongText/Button.vue +1 -1
  27. package/samples/LongText/ButtonItem.vue +1 -1
  28. package/samples/LongText/LongTextScroll.vue +3 -3
  29. package/samples/Marquee/App.vue +176 -40
  30. package/samples/Marquee/longText.js +14 -0
  31. package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
  32. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +3 -3
  33. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
  34. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
  35. package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  36. package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  37. package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
  38. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  39. package/samples/MetroWidgetDemos/Item.vue +20 -2
  40. package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
  41. package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
  42. package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +1 -1
  43. package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
  44. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
  45. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
  46. package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +3 -11
  47. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
  48. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
  49. package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
  50. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +6 -6
  51. package/samples/MetroWidgetDemos/WidgetItem.vue +2 -2
  52. package/samples/MetroWidgetDemos/data.js +2 -1
  53. package/samples/NinePatchDemo/App.vue +2 -2
  54. package/samples/NinePatchDemo/Item.vue +1 -1
  55. package/samples/Preload/App.vue +17 -12
  56. package/samples/Preload/Item.vue +1 -1
  57. package/samples/QrcodeDemo/App.vue +1 -1
  58. package/samples/ScaleDownNeon/App.vue +107 -0
  59. package/samples/SoundPool/App.vue +1 -1
  60. package/samples/TextBox/App.vue +9 -82
  61. package/samples/TextBox/RenderCenter.vue +40 -16
  62. package/samples/TextBox/RenderLeft.vue +48 -19
  63. package/samples/TextBox/RenderOneLine.vue +30 -49
  64. package/samples/TextBox/RenderRight.vue +40 -16
  65. package/samples/TextShadowDemo/App.vue +11 -17
  66. package/samples/TextureAnimation/App2.vue +43 -15
  67. package/samples/TextureAnimation/assets/light.png +0 -0
  68. package/samples/TextureAnimation/assets/light2.png +0 -0
  69. package/samples/TextureSize/App.vue +3 -3
  70. package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
  71. package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
  72. package/samples/TransitPage/App.vue +1 -1
  73. package/samples/VideoDemo/App.vue +8 -8
  74. package/samples/VideoDemo/components/Button.vue +1 -1
  75. package/samples/VisibleSensorDemo/App.vue +94 -27
  76. package/tsconfig.json +6 -6
  77. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +55 -59
  78. package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
  79. package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
  80. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +226 -107
  81. package/utils/JsViewEngineWidget/TemplateParser.js +227 -178
  82. package/utils/JsViewEngineWidget/WidgetCommon.js +13 -5
  83. package/utils/JsViewEngineWidget/index.js +3 -2
  84. package/utils/JsViewPlugin/BrowserPluginLoader.js +1 -1
  85. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
  86. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +23 -2
  87. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +1 -1
  88. package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
  89. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  90. package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
  91. package/utils/JsViewVueTools/JsvStyleClass.js +1 -1
  92. package/utils/JsViewVueTools/index.js +2 -1
  93. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
  94. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +1 -1
  95. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +7 -9
  96. package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
  97. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +3 -3
  98. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
  99. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +5 -5
  100. package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
  101. package/utils/JsViewVueWidget/JsvGrid.vue +3 -11
  102. package/utils/JsViewVueWidget/JsvInput/Cursor.vue +5 -3
  103. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +15 -14
  104. package/utils/JsViewVueWidget/JsvMarquee.vue +180 -207
  105. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +2 -2
  106. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
  107. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
  108. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +38 -42
  109. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  110. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  111. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +24 -8
  112. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +23 -3
  113. package/utils/JsViewVueWidget/JsvTextBox.vue +20 -86
  114. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -9
  115. package/utils/JsViewVueWidget/JsvTouchContainer.vue +6 -7
  116. package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
  117. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +6 -6
  118. package/utils/JsViewVueWidget/index.js +8 -8
  119. package/utils/JsViewVueWidget/utils/index.js +8 -0
  120. package/utils/JsViewVueWidget/utils/text.js +19 -0
  121. package/dom/bin/jsview-browser-debug-dom.min.js +0 -1
  122. package/dom/bin/jsview-dom.min.js +0 -1
  123. package/dom/bin/jsview-forge-define.min.js +0 -1
  124. package/dom/browser-root-style.css +0 -21
  125. package/dom/jsv-browser-debug-dom.js +0 -8
  126. package/dom/jsv-dom.js +0 -6
  127. package/dom/jsv-forge-define.js +0 -6
  128. package/dom/target_core_revision.mjs +0 -15
  129. package/loader/header_script_loader.js +0 -134
  130. package/loader/jsview-main.js +0 -42
  131. package/loader/jsview.config.default.js +0 -37
  132. package/loader/jsview.default.config.js +0 -37
  133. package/loader/loader.js +0 -179
  134. package/loader/loader_webkit.js +0 -40
  135. package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17609
  136. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -335
  137. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +0 -446
  138. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +0 -91
  139. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8038
  140. package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1700
  141. package/patches/node_modules/postcss-js/objectifier.js +0 -90
  142. package/patches/node_modules/vite/dist/node/chunks/dep-0fc8e132.js +0 -63147
  143. package/patches/node_modules/vite/dist/node/jsview.vite.config.js +0 -53
  144. package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3595
  145. package/scripts/common.js +0 -58
  146. package/scripts/jsview-install-local-packages.js +0 -73
  147. package/scripts/jsview-jsmap-serve.js +0 -105
  148. package/scripts/jsview-post-build.js +0 -183
  149. package/scripts/jsview-post-install.js +0 -102
  150. package/scripts/jsview-run-android.js +0 -67
  151. package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
  152. package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
  153. package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
  154. package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
  155. package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
  156. package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
  157. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
@@ -2,21 +2,46 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-11 13:31:36
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-18 09:59:32
5
+ * @LastEditTime: 2022-11-02 15:35:12
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { MetroWidget, VERTICAL, EdgeDirection } from "jsview";
10
- import { useFocusHub } from "jsview";
11
- import { advanceMetroWidget } from "../data";
12
- import WidgetItem from "../WidgetItem.vue";
9
+ import {
10
+ MetroWidget,
11
+ VERTICAL,
12
+ EdgeDirection,
13
+ JsvNinePatch,
14
+ useFocusHub,
15
+ } from "jsview";
16
+ import { advanceMetroWidget } from "../../data";
17
+ import WidgetItem from "../widgets/WidgetItem.vue";
18
+ import focusImg from "./focus1.png";
19
+ import { ref, shallowRef, reactive, provide } from "vue";
13
20
 
14
- const foucsHub = useFocusHub();
21
+ const focusHub = useFocusHub();
22
+ const showFocus = ref(false);
15
23
 
16
- //item为Widgetitem的一些回调
17
24
  const provideData = () => {
18
25
  return advanceMetroWidget;
19
26
  };
27
+
28
+ const onFocus = () => {
29
+ console.log("testtest", " widget onfocus");
30
+ showFocus.value = true;
31
+ };
32
+
33
+ const onBlur = () => {
34
+ showFocus.value = false;
35
+ };
36
+
37
+ const focusSize = reactive({
38
+ width: 0,
39
+ height: 0,
40
+ left: 0,
41
+ top: 0,
42
+ });
43
+ provide("focusSize", focusSize);
44
+
20
45
  // measures中会返回doSlide: false, 既MetroWidget自身不处理滚动, 滚动由子的sendFocusRectEvent控制
21
46
  const measures = (item) => {
22
47
  return {
@@ -29,7 +54,7 @@ const measures = (item) => {
29
54
  };
30
55
  const onEdge = (edgeInfo) => {
31
56
  if (edgeInfo.direction == EdgeDirection.left) {
32
- foucsHub.setFocus("mwButton");
57
+ focusHub.setFocus("mwButton");
33
58
  }
34
59
  };
35
60
  </script>
@@ -38,7 +63,7 @@ const onEdge = (edgeInfo) => {
38
63
  <div
39
64
  :style="{
40
65
  left: 500,
41
- top: 50,
66
+ top: 20,
42
67
  width: 500,
43
68
  height: 400,
44
69
  fontSize: 30,
@@ -47,16 +72,20 @@ const onEdge = (edgeInfo) => {
47
72
  >
48
73
  {{ `进一步, MetroWidget的item\n可以是包含MetroWidget的组件` }}
49
74
  </div>
75
+ <!-- 为了保证边缘的item缩放后依旧完整显示, 需要设置padding, 注意width/height是包含padding的 -->
50
76
  <metro-widget
51
77
  name="mwWidget"
52
- :top="150"
78
+ :top="100"
53
79
  :left="400"
54
80
  :provideData="provideData"
55
- :width="600"
81
+ :width="660"
56
82
  :height="600"
83
+ :padding="{ left: 30, right: 30 }"
57
84
  :direction="VERTICAL"
58
85
  :measures="measures"
59
86
  :onEdge="onEdge"
87
+ :onFocus="onFocus"
88
+ :onBlur="onBlur"
60
89
  >
61
90
  <!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口, onItemEdge则是item内部焦点处理到达边缘后, 需要通知MetroWidget时的回调 -->
62
91
  <template #renderItem="{ data, query, onAction, onItemEdge }">
@@ -68,4 +97,20 @@ const onEdge = (edgeInfo) => {
68
97
  />
69
98
  </template>
70
99
  </metro-widget>
100
+ <jsv-nine-patch
101
+ v-show="showFocus"
102
+ :style="{
103
+ width: focusSize.width,
104
+ height: focusSize.height,
105
+ top: focusSize.top,
106
+ left: focusSize.left,
107
+ }"
108
+ :imageUrl="focusImg"
109
+ :imageWidth="55"
110
+ :centerWidth="1"
111
+ :borderOutset="13"
112
+ :imageDspWidth="55"
113
+ :animTime="0.2"
114
+ :waitForInit="true"
115
+ ></jsv-nine-patch>
71
116
  </template>
@@ -2,11 +2,11 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-05-10 15:21:24
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-11 17:00:58
5
+ * @LastEditTime: 2022-11-01 15:24:26
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { ref } from "vue";
9
+ import { ref, shallowRef, inject } from "vue";
10
10
 
11
11
  const props = defineProps({
12
12
  data: Object,
@@ -14,11 +14,28 @@ const props = defineProps({
14
14
  onAction: Object,
15
15
  });
16
16
 
17
+ const divRef = shallowRef(null);
17
18
  const focused = ref(false);
18
19
 
20
+ const focusSize = inject("focusSize");
21
+
19
22
  // 自身的焦点状态自己记录, 通过回调来改变
20
23
  const onFocus = () => {
21
24
  focused.value = true;
25
+ if (focusSize) {
26
+ divRef.value?.getBoundingClientRect().then(
27
+ (data) => {
28
+ console.log("testtest focus size", data)
29
+ focusSize.width = data.width;
30
+ focusSize.height = data.height;
31
+ focusSize.left = data.left;
32
+ focusSize.top = data.top;
33
+ },
34
+ (error) => {
35
+ console.log("testtest abs failed", error);
36
+ }
37
+ );
38
+ }
22
39
  };
23
40
  const onBlur = () => {
24
41
  focused.value = false;
@@ -53,6 +70,7 @@ props.onAction.register("onClick", onClick);
53
70
  }"
54
71
  ></div>
55
72
  <div
73
+ ref="divRef"
56
74
  :style="{
57
75
  width: data.width,
58
76
  height: data.height,
@@ -76,7 +76,7 @@ import { data1, data2, data3 } from "./data";
76
76
  import borderImgPath from "./border.png";
77
77
  import Item from "./components/ContentItem.vue";
78
78
  import MyTab from "./components/MyTab.vue";
79
- import { ref, onMounted, onBeforeUnmount } from "vue";
79
+ import { ref, shallowRef, onMounted, onBeforeUnmount } from "vue";
80
80
  import { useRouter } from "vue-router";
81
81
  import {
82
82
  VERTICAL,
@@ -90,7 +90,7 @@ const router = useRouter();
90
90
  const focusHub = useFocusHub();
91
91
  let contentData = data1;
92
92
  let requestDataTime = 0;
93
- const mwRef = ref(null);
93
+ const mwRef = shallowRef(null);
94
94
 
95
95
  const onKeyDown = (ev) => {
96
96
  // 8:Backspace, 27:Escape, 10000:盒子返回键
@@ -127,7 +127,7 @@ const onItemFocus = (id) => {
127
127
  clearTimeout(requestDataTime);
128
128
  requestDataTime = 0;
129
129
  }
130
- requestDataTime = setTimeout(() => {
130
+ // requestDataTime = setTimeout(() => {
131
131
  switch (id) {
132
132
  case 0:
133
133
  contentData = data1;
@@ -140,7 +140,7 @@ const onItemFocus = (id) => {
140
140
  break;
141
141
  }
142
142
  mwRef.value?.refreshData(true);
143
- }, 0);
143
+ // }, 0);
144
144
  };
145
145
 
146
146
  onBeforeUnmount(() => {
@@ -13,7 +13,7 @@ import couponMid from "../assets/coupon_mid.png";
13
13
  import borderLeft from "../assets/line_left.png";
14
14
  import borderMid from "../assets/line_mid.png";
15
15
  import borderRight from "../assets/line_right.png";
16
- import { ref, computed } from "vue";
16
+ import { ref, shallowRef, computed } from "vue";
17
17
 
18
18
  const props = defineProps({
19
19
  data: Object,
@@ -6,7 +6,7 @@
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
- import { ref } from "vue";
9
+ import { ref, shallowRef } from "vue";
10
10
 
11
11
  export default {
12
12
  props: {
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-12-21 15:36:29
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 16:11:32
5
+ * @LastEditTime: 2022-09-01 17:08:21
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -20,13 +20,13 @@ for (let i = 0; i < 5; i++) {
20
20
  width: 100,
21
21
  height: 50,
22
22
  marginRight: 10,
23
- content: "Tab-" + i,
23
+ content: "Tab_" + i,
24
24
  color: randomColor(),
25
25
  });
26
26
 
27
27
  let data = JSON.parse(JSON.stringify(advanceMetroWidget));
28
28
  data.forEach((item) => {
29
- item.name = "testPage-" + i + "-" + item.name;
29
+ item.name = "testPage_" + i + "-" + item.name;
30
30
  });
31
31
  pageList.push({
32
32
  width: 600,
@@ -2,13 +2,13 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 10:45:38
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 14:43:49
5
+ * @LastEditTime: 2022-09-01 17:04:31
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
9
  import { VERTICAL, MetroWidget } from "jsview";
10
10
  import WidgetItem from "../WidgetItem.vue";
11
- import { reactive } from "vue";
11
+ import { ref, shallowRef, watch, onBeforeUnmount } from "vue";
12
12
 
13
13
  const props = defineProps({
14
14
  data: {
@@ -24,6 +24,8 @@ const props = defineProps({
24
24
  },
25
25
  });
26
26
 
27
+ const widgetRef = shallowRef(null);
28
+
27
29
  const provideData = () => {
28
30
  return props.data.data;
29
31
  };
@@ -34,10 +36,23 @@ const measures = (item) => {
34
36
  doSlide: false,
35
37
  };
36
38
  };
39
+
40
+ const watcher = watch(
41
+ () => props.data,
42
+ (newValue, oldValue) => {
43
+ widgetRef.value?.refreshData();
44
+ }
45
+ );
46
+
47
+ onBeforeUnmount(() => {
48
+ watcher();
49
+ })
50
+
37
51
  </script>
38
52
 
39
53
  <template>
40
54
  <metro-widget
55
+ ref="widgetRef"
41
56
  :name="name"
42
57
  :width="data.width"
43
58
  :height="data.height"
@@ -2,19 +2,12 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 10:45:19
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 15:39:29
5
+ * @LastEditTime: 2022-09-01 16:19:51
6
6
  * @Description: file content
7
7
  -->
8
- <!--
9
- * @Author: ChenChanghua
10
- * @Date: 2021-12-21 17:18:58
11
- * @LastEditors: ChenChanghua
12
- * @LastEditTime: 2021-12-28 10:58:25
13
- * @Description: 标题 tab
14
- -->
15
8
  <script setup>
16
9
  import { HORIZONTAL, MetroWidget } from "jsview";
17
- import Item from "./Item.vue";
10
+ import TabItem from "./TabItem.vue";
18
11
 
19
12
  const props = defineProps({
20
13
  data: {
@@ -62,7 +55,7 @@ const provideData = () => {
62
55
  }"
63
56
  >
64
57
  <template #renderItem="{ data, query, onAction }">
65
- <item :data="data" :query="query" :onAction="onAction"></item>
58
+ <tab-item :data="data" :query="query" :onAction="onAction"></tab-item>
66
59
  </template>
67
60
  </metro-widget>
68
61
  </jsv-focus-block>
@@ -2,18 +2,11 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 14:52:53
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 16:08:56
6
- * @Description: file content
7
- -->
8
- <!--
9
- * @Author: ChenChanghua
10
- * @Date: 2022-05-10 15:21:24
11
- * @LastEditors: ChenChanghua
12
- * @LastEditTime: 2022-07-11 17:00:58
5
+ * @LastEditTime: 2022-09-01 17:10:14
13
6
  * @Description: file content
14
7
  -->
15
8
  <script setup>
16
- import { ref, inject } from "vue";
9
+ import { ref, shallowRef, inject } from "vue";
17
10
 
18
11
  const props = defineProps({
19
12
  data: Object,
@@ -33,13 +26,12 @@ const onFocus = () => {
33
26
  active.value = false;
34
27
  };
35
28
  const onBlur = () => {
36
- console.log("cchtest item onblur");
37
29
  focused.value = false;
38
30
  active.value =
39
31
  props.query.getCurrentFocusId().id === props.query.id ? true : false;
40
32
  };
41
33
  const onClick = () => {
42
- console.log("item onclick ", props.data);
34
+ console.log("tab item onclick ", props.data);
43
35
  };
44
36
 
45
37
  // 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
@@ -2,13 +2,13 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 10:30:33
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-13 10:50:43
5
+ * @LastEditTime: 2022-09-01 17:05:07
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
9
  import AppPage from "./AppPage.vue";
10
10
  import { getKeyFramesGroup } from "jsview";
11
- import { reactive } from "vue";
11
+ import { reactive, ref, shallowRef } from "vue";
12
12
 
13
13
  export default {
14
14
  components: {
@@ -10,7 +10,7 @@ import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
10
10
  import { useFocusHub } from "jsview";
11
11
  import { simpleDataAbs } from "../data";
12
12
  import Item from "../Item.vue";
13
- const foucsHub = useFocusHub();
13
+ const focusHub = useFocusHub();
14
14
 
15
15
  const wholePageSlide = new WholePageSlide();
16
16
 
@@ -29,7 +29,7 @@ const measuresAbs = (item) => {
29
29
  };
30
30
  const onEdgeAbs = (edgeInfo) => {
31
31
  if (edgeInfo.direction == EdgeDirection.left) {
32
- foucsHub.setFocus("mw");
32
+ focusHub.setFocus("mw");
33
33
  }
34
34
  };
35
35
  </script>
@@ -13,10 +13,10 @@ import AbsoluteTemplate from "./AbsoluteTemplate.vue";
13
13
  import RelativeTemplate from "./RelativeTemplate.vue";
14
14
 
15
15
  const router = useRouter();
16
- const foucsHub = useFocusHub();
16
+ const focusHub = useFocusHub();
17
17
 
18
18
  const onFocus = () => {
19
- foucsHub.setFocus("button");
19
+ focusHub.setFocus("button");
20
20
  };
21
21
  const onKeyDown = (ev) => {
22
22
  if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
@@ -7,13 +7,13 @@
7
7
  -->
8
8
  <script setup>
9
9
  import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
10
- import { ref } from "vue";
10
+ import { ref, shallowRef } from "vue";
11
11
  import { useFocusHub } from "jsview";
12
12
  import { simpleData } from "../data";
13
13
  import Item from "../Item.vue";
14
14
 
15
- const foucsHub = useFocusHub();
16
- const mwRef = ref(null);
15
+ const focusHub = useFocusHub();
16
+ const mwRef = shallowRef(null);
17
17
 
18
18
  const wholePageSlide = new WholePageSlide();
19
19
  let innerData = simpleData.concat();
@@ -34,9 +34,9 @@ const onEdge = (edgeInfo) => {
34
34
  // MetroWidget焦点到达边缘后的回调
35
35
  if (edgeInfo.direction == EdgeDirection.top) {
36
36
  buttonFocus.value = true;
37
- foucsHub.setFocus("button");
37
+ focusHub.setFocus("button");
38
38
  } else if (edgeInfo.direction == EdgeDirection.right) {
39
- foucsHub.setFocus("mwAbs");
39
+ focusHub.setFocus("mwAbs");
40
40
  }
41
41
  };
42
42
 
@@ -45,7 +45,7 @@ const buttonOnKeyDown = (ev) => {
45
45
  switch (ev.keyCode) {
46
46
  case 40:
47
47
  buttonFocus.value = false;
48
- foucsHub.setFocus("mw");
48
+ focusHub.setFocus("mw");
49
49
  return true;
50
50
  case 13:
51
51
  if (innerData.length == simpleData.length) {
@@ -1,7 +1,7 @@
1
1
 
2
2
  <script setup>
3
3
  import { HORIZONTAL, MetroWidget, useFocusHub } from "jsview";
4
- import { ref } from "vue";
4
+ import { ref, shallowRef } from "vue";
5
5
  import Item from "./Item.vue";
6
6
 
7
7
  const props = defineProps({
@@ -11,7 +11,7 @@ const props = defineProps({
11
11
  onAction: Object,
12
12
  });
13
13
  const focusHub = useFocusHub();
14
- const mwRef = ref(null);
14
+ const mwRef = shallowRef(null);
15
15
 
16
16
  const measures = (item) => {
17
17
  return item;
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-11 14:00:33
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 14:35:01
5
+ * @LastEditTime: 2022-11-02 15:23:08
6
6
  * @Description: file content
7
7
  */
8
8
 
@@ -177,6 +177,7 @@ for (let i = 0; i < 10; i++) {
177
177
  height: 170,
178
178
  name: "widget_" + i,
179
179
  marginBottom: 10,
180
+ index: i,
180
181
  });
181
182
  }
182
183
 
@@ -7,7 +7,7 @@ import {
7
7
  } from "jsview";
8
8
  import Item from "./Item.vue";
9
9
  import borderImageUrl from "./assets/border.png";
10
- import { ref, onMounted } from "vue";
10
+ import { ref, shallowRef, onMounted } from "vue";
11
11
  import { useRouter, useRoute } from "vue-router";
12
12
 
13
13
  const router = useRouter();
@@ -77,7 +77,7 @@ const _onKeyDown = (ev) => {
77
77
  return false;
78
78
  };
79
79
 
80
- const myFocusWidget = ref(null);
80
+ const myFocusWidget = shallowRef(null);
81
81
 
82
82
  onMounted(() => {
83
83
  myFocusWidget.value.getFocusBlockRef().requestFocus();
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref, computed } from "vue";
2
+ import { ref, shallowRef, computed } from "vue";
3
3
 
4
4
  const props = defineProps({
5
5
  data: Object,
@@ -5,20 +5,21 @@ import {
5
5
  JsvPreload,
6
6
  buildPreloadInfo,
7
7
  buildDownloadInfo,
8
+ useFocusHub,
8
9
  } from "jsview";
9
10
  import awesome from "./images/awesomeface.png";
10
11
  import cat from "./images/cat.jpg";
11
12
  import { data } from "./data.js";
12
13
  import Item from "./Item.vue";
13
- import { ref } from "vue";
14
+ import { ref, shallowRef } from "vue";
14
15
  import { useRouter } from "vue-router";
15
16
 
16
17
  const name = "/preload";
18
+ const focusHub = useFocusHub();
17
19
  const text = ref("");
18
- let = preloadInfo = [];
19
- let = downloadInfo = [];
20
+ let preloadInfo = [];
21
+ let downloadInfo = [];
20
22
  const router = useRouter();
21
- let focusNode = ref(null);
22
23
 
23
24
  const _onPreloading = (percent) => {
24
25
  console.log("preloading ", percent);
@@ -28,9 +29,9 @@ const _onPreloadDone = (imageInfo) => {
28
29
  console.log("PRELOAD DONE!", imageInfo);
29
30
  };
30
31
 
31
- const _onDownloadDone = () => {
32
- console.log("DOWNLOAD DONE!");
33
- this.text = `图片下载完成\n${awesome}\n${cat}`;
32
+ const _onDownloadDone = (urls, extra) => {
33
+ console.log("DOWNLOAD DONE!", urls, extra);
34
+ text.value = `图片下载完成\n${awesome}\n${cat}`;
34
35
  };
35
36
 
36
37
  const _measures = () => {
@@ -43,13 +44,13 @@ const _measures = () => {
43
44
 
44
45
  const _onKeyDown = (ev) => {
45
46
  if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
46
- router.go(-1); // 有router时,是从DemoHomepage进入,回退
47
+ router?.go(-1); // 有router时,是从DemoHomepage进入,回退
47
48
  }
48
49
  return true;
49
50
  };
50
51
 
51
52
  const _onFocus = () => {
52
- focusNode.value.findBlockByName(name).requestFocus();
53
+ focusHub.setFocus(name);
53
54
  };
54
55
 
55
56
  for (const item of data) {
@@ -58,16 +59,20 @@ for (const item of data) {
58
59
  }
59
60
  preloadInfo.push(null); // 测试item为null的加载
60
61
  downloadInfo = [
61
- buildDownloadInfo(awesome),
62
- buildDownloadInfo(cat),
62
+ buildDownloadInfo(awesome, null, true),
63
+ buildDownloadInfo(cat, null, true),
63
64
  buildDownloadInfo(null), // 测试URL为null的加载
64
65
  ];
65
66
  </script>
66
67
 
67
68
  <template>
68
69
  <jsv-focus-block
69
- ref="focusNode"
70
70
  autoFocus
71
+ :style="{
72
+ width: 1920,
73
+ height: 1080,
74
+ backgroundColor: '#FFFFFF',
75
+ }"
71
76
  :onAction="{
72
77
  onKeyDown: _onKeyDown,
73
78
  onFocus: _onFocus,
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref } from "vue";
2
+ import { ref, shallowRef } from "vue";
3
3
  const props = defineProps({
4
4
  data: Object,
5
5
  query: Object,
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { JsvQrcode } from "jsview";
3
- import { ref } from "vue";
3
+ import { ref, shallowRef } from "vue";
4
4
  import { useRouter } from "vue-router";
5
5
 
6
6
  const router = useRouter();