@shijiu/jsview-vue-samples 1.9.887 → 1.9.915

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 (185) hide show
  1. package/AnimPicture/App.vue +10 -10
  2. package/Basic/App.vue +1 -1
  3. package/Basic/components/FontStyle.css +4 -4
  4. package/Basic/components/anim/AnimKeyframeBasic.vue +1 -1
  5. package/Basic/components/anim/AnimKeyframeComposite.vue +2 -2
  6. package/Basic/components/anim/AnimTransition.vue +4 -4
  7. package/Basic/components/div/DivClip.vue +0 -39
  8. package/Basic/components/div/DivCssScoped.vue +1 -1
  9. package/Basic/components/div/DivLayout.vue +1 -1
  10. package/Basic/components/div/DivRadius.vue +4 -4
  11. package/Basic/components/img/ImageGroup.vue +2 -2
  12. package/Basic/components/img/ImgLayout.vue +78 -14
  13. package/Basic/components/text/TextDirection.vue +9 -9
  14. package/Basic/components/text/TextEmoji.vue +7 -2
  15. package/Basic/components/text/TextFontStyle.vue +4 -4
  16. package/Basic/components/text/TextGroup1.vue +1 -1
  17. package/Basic/components/text/TextGroup2.vue +2 -2
  18. package/BasicFocusControl/App.vue +2 -2
  19. package/BasicFocusControl/components/BaseBlock.vue +2 -2
  20. package/BasicFocusControl/components/MainArea.vue +2 -2
  21. package/BasicFocusControl/components/SideBar.vue +2 -2
  22. package/Collision/App.vue +16 -16
  23. package/ColorSpace/App.vue +11 -11
  24. package/CssPreprocessor/App.vue +70 -0
  25. package/CssPreprocessor/Less/App.vue +32 -0
  26. package/CssPreprocessor/Less/PanelData.js +51 -0
  27. package/CssPreprocessor/Less/components/less-group1/LessComments.vue +34 -0
  28. package/CssPreprocessor/Less/components/less-group1/LessConditionals.vue +32 -0
  29. package/CssPreprocessor/Less/components/less-group1/LessOperations.vue +24 -0
  30. package/CssPreprocessor/Less/components/less-group1/LessVariables.vue +48 -0
  31. package/CssPreprocessor/Less/components/less-group2/LessIteration.vue +32 -0
  32. package/CssPreprocessor/Less/components/less-group2/LessMethods.vue +27 -0
  33. package/CssPreprocessor/Less/components/less-group3/LessExtends.vue +32 -0
  34. package/CssPreprocessor/Less/components/less-group3/LessNesting.vue +63 -0
  35. package/CssPreprocessor/Less/components/less-group4/LessKeyframes.vue +40 -0
  36. package/CssPreprocessor/Less/components/less-group4/LessMaps.vue +33 -0
  37. package/CssPreprocessor/Less/components/less-group4/LessMixins.vue +33 -0
  38. package/CssPreprocessor/Less/components/less-group5/LessImporting.vue +34 -0
  39. package/CssPreprocessor/Less/components/less-group5/TextSettings.less +4 -0
  40. package/CssPreprocessor/Scss/App.vue +32 -0
  41. package/CssPreprocessor/Scss/PanelData.js +51 -0
  42. package/CssPreprocessor/Scss/components/scss-group1/ScssComments.vue +34 -0
  43. package/CssPreprocessor/Scss/components/scss-group1/ScssConditionals.vue +36 -0
  44. package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +30 -0
  45. package/CssPreprocessor/Scss/components/scss-group1/ScssVariables.vue +48 -0
  46. package/CssPreprocessor/Scss/components/scss-group2/ScssIteration.vue +36 -0
  47. package/CssPreprocessor/Scss/components/scss-group2/ScssMethods.vue +84 -0
  48. package/CssPreprocessor/Scss/components/scss-group3/ScssExtends.vue +34 -0
  49. package/CssPreprocessor/Scss/components/scss-group3/ScssNesting.vue +75 -0
  50. package/CssPreprocessor/Scss/components/scss-group4/ScssKeyframes.vue +40 -0
  51. package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +35 -0
  52. package/CssPreprocessor/Scss/components/scss-group4/ScssMixins.vue +33 -0
  53. package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +34 -0
  54. package/CssPreprocessor/Scss/components/scss-group5/TextSettings.scss +4 -0
  55. package/CssPreprocessor/Stylus/App.vue +32 -0
  56. package/CssPreprocessor/Stylus/PanelData.js +51 -0
  57. package/CssPreprocessor/Stylus/components/stylus-group1/StylusComments.vue +34 -0
  58. package/CssPreprocessor/Stylus/components/stylus-group1/StylusConditionals.vue +36 -0
  59. package/CssPreprocessor/Stylus/components/stylus-group1/StylusOperations.vue +30 -0
  60. package/CssPreprocessor/Stylus/components/stylus-group1/StylusVariables.vue +47 -0
  61. package/CssPreprocessor/Stylus/components/stylus-group2/StylusIteration.vue +34 -0
  62. package/CssPreprocessor/Stylus/components/stylus-group2/StylusMethods.vue +78 -0
  63. package/CssPreprocessor/Stylus/components/stylus-group3/StylusExtends.vue +34 -0
  64. package/CssPreprocessor/Stylus/components/stylus-group3/StylusNesting.vue +63 -0
  65. package/CssPreprocessor/Stylus/components/stylus-group4/StylusKeyframes.vue +40 -0
  66. package/CssPreprocessor/Stylus/components/stylus-group4/StylusMaps.vue +33 -0
  67. package/CssPreprocessor/Stylus/components/stylus-group4/StylusMixins.vue +33 -0
  68. package/CssPreprocessor/Stylus/components/stylus-group5/StylusImporting.vue +34 -0
  69. package/CssPreprocessor/Stylus/components/stylus-group5/TextSettings.styl +4 -0
  70. package/CssPreprocessor/utils/ContentBlock.vue +43 -0
  71. package/CssPreprocessor/utils/ContentList.vue +34 -0
  72. package/CssPreprocessor/utils/FontStyle.css +19 -0
  73. package/CssPreprocessor/utils/Panel.vue +49 -0
  74. package/CssPreprocessor/utils/TitleBar.vue +29 -0
  75. package/DemoHomepage/App.vue +46 -11
  76. package/DemoHomepage/components/Dialog.vue +15 -15
  77. package/DemoHomepage/router.js +20 -12
  78. package/DemoHomepage/views/Homepage.vue +90 -102
  79. package/DivMetroPerformance/App.vue +150 -0
  80. package/DivMetroPerformance/Item.vue +58 -0
  81. package/DivMetroPerformance/assets/bg.jpg +0 -0
  82. package/DivMetroPerformance/assets/coupon_content.png +0 -0
  83. package/DivMetroPerformance/assets/coupon_left.png +0 -0
  84. package/DivMetroPerformance/assets/coupon_mid.png +0 -0
  85. package/DivMetroPerformance/assets/coupon_right.png +0 -0
  86. package/DivMetroPerformance/assets/focus_border.png +0 -0
  87. package/DivMetroPerformance/assets/holder_logo.png +0 -0
  88. package/DivMetroPerformance/assets/jrbm.png +0 -0
  89. package/DivMetroPerformance/assets/line_left.png +0 -0
  90. package/DivMetroPerformance/assets/line_mid.png +0 -0
  91. package/DivMetroPerformance/assets/line_right.png +0 -0
  92. package/DivMetroPerformance/assets/loading.png +0 -0
  93. package/DivMetroPerformance/assets/logo.png +0 -0
  94. package/DivMetroPerformance/assets/mcjx.png +0 -0
  95. package/DivMetroPerformance/assets/tao.png +0 -0
  96. package/DivMetroPerformance/assets/tmall.png +0 -0
  97. package/DivMetroPerformance/border.png +0 -0
  98. package/DivMetroPerformance/components/ContentItem.vue +385 -0
  99. package/DivMetroPerformance/components/MyTab.vue +129 -0
  100. package/DivMetroPerformance/data.js +124 -0
  101. package/DivMetroPerformance/utils/GridItem.vue +28 -0
  102. package/DivMetroPerformance/utils/GridPlate.vue +85 -0
  103. package/FilterDemo/AnimatePic.vue +3 -3
  104. package/FilterDemo/App.vue +3 -3
  105. package/FlipCard/App.vue +2 -2
  106. package/FlipCard/FlipCard.vue +2 -2
  107. package/GridDemo/Item.vue +13 -13
  108. package/HashHistory/App.vue +0 -1
  109. package/HashHistory/components/Item.vue +2 -2
  110. package/HashHistory/views/MainPage.vue +1 -1
  111. package/HashHistory/views/SubPage.vue +2 -2
  112. package/ImpactStop/App.vue +9 -11
  113. package/Input/InputPanel.vue +2 -4
  114. package/LongImage/App.vue +2 -2
  115. package/LongImage/Button.vue +1 -1
  116. package/LongImage/ButtonItem.vue +1 -1
  117. package/LongText/App.vue +3 -3
  118. package/LongText/Button.vue +1 -1
  119. package/LongText/ButtonItem.vue +1 -1
  120. package/LongText/LongTextScroll.vue +4 -4
  121. package/Marquee/longText.js +0 -2
  122. package/MaskClip/App.vue +4 -4
  123. package/MediaDemo/App.vue +127 -0
  124. package/MediaDemo/assets/audio-poster.png +0 -0
  125. package/MediaDemo/components/Button.vue +69 -0
  126. package/MediaDemo/components/Controllor.vue +279 -0
  127. package/MediaDemo/components/StatusBar.vue +100 -0
  128. package/MediaDemo/components/frames/AudioFrame.vue +39 -0
  129. package/MediaDemo/components/frames/AudioPoster.vue +48 -0
  130. package/MediaDemo/components/frames/MediaFrame.vue +153 -0
  131. package/MediaDemo/components/frames/VideoFrame.vue +39 -0
  132. package/MetroWidgetDemos/Advanced/ButtonItem.vue +4 -4
  133. package/MetroWidgetDemos/Advanced/widgets/Item.vue +5 -5
  134. package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +2 -2
  135. package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +57 -56
  136. package/MetroWidgetDemos/Item.vue +4 -5
  137. package/MetroWidgetDemos/PerformanceTest/App.vue +3 -3
  138. package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +26 -26
  139. package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +15 -15
  140. package/MetroWidgetDemos/PingPong/AppPage.vue +2 -2
  141. package/MetroWidgetDemos/PingPong/TabItem.vue +2 -2
  142. package/MetroWidgetDemos/PingPong/ViewSwiper.vue +9 -9
  143. package/MetroWidgetDemos/Simple/RelativeTemplate.vue +2 -2
  144. package/MetroWidgetDemos/WidgetItem.vue +2 -2
  145. package/NinePatchDemo/App.vue +3 -3
  146. package/NinePatchDemo/Item.vue +5 -5
  147. package/Preload/App.vue +5 -5
  148. package/Preload/Item.vue +1 -1
  149. package/QrcodeDemo/App.vue +3 -3
  150. package/ScaleDownNeon/App.vue +9 -9
  151. package/SoundPool/App.vue +6 -9
  152. package/SprayView/App.vue +22 -22
  153. package/SpriteImage/App.vue +4 -4
  154. package/Swiper/App.vue +2 -8
  155. package/TextBox/App.vue +1 -2
  156. package/TextBox/RenderCenter.vue +16 -16
  157. package/TextBox/RenderLeft.vue +16 -16
  158. package/TextBox/RenderOneLine.vue +12 -12
  159. package/TextBox/RenderRight.vue +16 -16
  160. package/TextShadowDemo/App.vue +4 -4
  161. package/TextureAnimation/App.vue +1 -17
  162. package/TextureAnimation/App2.vue +3 -3
  163. package/TextureSize/App.vue +8 -8
  164. package/ThrowMoveDemo/AccelerateDemo.vue +4 -4
  165. package/ThrowMoveDemo/LRParabolicDemo.vue +4 -4
  166. package/ThrowMoveDemo/TargetDemo.vue +4 -4
  167. package/ThrowMoveDemo/UDParabolicDemo.vue +4 -4
  168. package/TouchSample/App.vue +2 -2
  169. package/TouchSample/Item.vue +2 -2
  170. package/TouchSample/MetroWidgetHorizontal.vue +3 -3
  171. package/TouchSample/MetroWidgetVertical.vue +3 -3
  172. package/TouchSample/TouchContainerHorizontal.vue +2 -2
  173. package/TouchSample/TouchContainerVertical.vue +2 -2
  174. package/TransitPage/App.vue +1 -1
  175. package/VideoDemo/App.vue +4 -4
  176. package/VideoDemo/components/Button.vue +1 -1
  177. package/VideoDemo/components/Controllor.vue +2 -2
  178. package/VideoDemo/components/VideoFrame.vue +1 -1
  179. package/VisibleSensorDemo/App.vue +7 -7
  180. package/assets/bmpDemo.bmp +0 -0
  181. package/assets/jpegDemo.jpeg +0 -0
  182. package/assets/pngDemo.png +0 -0
  183. package/assets/pngNoAlphaDemo.png +0 -0
  184. package/assets/webpDemo.webp +0 -0
  185. package/package.json +6 -1
@@ -0,0 +1,49 @@
1
+ <script>
2
+ import ContentList from './ContentList.vue';
3
+ import TitleBar from './TitleBar.vue';
4
+
5
+ export default {
6
+ props: {
7
+ style: Object,
8
+ panelData: Object,
9
+ sideline: Boolean
10
+ },
11
+ components: {
12
+ ContentList,
13
+ TitleBar,
14
+ },
15
+ computed: {
16
+ columnWidth() {
17
+ return this.style.width / this.panelData.title.length;
18
+ },
19
+ separatorColor() {
20
+ return 'rgba(0,0,255,0.7)'
21
+ }
22
+ },
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <div :style=style>
28
+ <!-- 分隔线 -->
29
+ <div v-if=sideline >
30
+ <div :style="{width:style.width, height:1, backgroundColor:separatorColor}" />
31
+ <div :style="{top:style.height, width:style.width, height:1, backgroundColor:separatorColor}" />
32
+ <div :style="{left: 0, width:1, height: style.height, backgroundColor:separatorColor}" />
33
+ <template v-for="(_, idx) in panelData.title" :key="idx" >
34
+ <div :style="{left: columnWidth*(idx+1), width:1, height: style.height, backgroundColor:separatorColor}" />
35
+ </template>
36
+ </div>
37
+
38
+ <TitleBar :style="{width: columnWidth}" :titleData=panelData.title />
39
+ <div :style="{top:20}" >
40
+ <ContentList v-for="(_, idx) in panelData.contentList.length" :key=idx
41
+ :style="{left: columnWidth*idx, width: columnWidth, height: style.height-20}" :startIndex=idx
42
+ :contentData=panelData.contentList[idx]
43
+ />
44
+ </div>
45
+ </div>
46
+ </template>
47
+
48
+ <style scoped>
49
+ </style>
@@ -0,0 +1,29 @@
1
+ <script>
2
+ export default {
3
+ props: {
4
+ style: Object,
5
+ titleData: Array
6
+ }
7
+ }
8
+ </script>
9
+
10
+ <template>
11
+ <div>
12
+ <template v-for="(title, index) in titleData" :key="index" >
13
+ <div class='title-font title-range' :style="{left: style.width * index}">
14
+ {{ title }}
15
+ </div>
16
+ </template>
17
+ </div>
18
+ </template>
19
+
20
+ <style scoped>
21
+ @import "./FontStyle.css";
22
+
23
+ .title-range {
24
+ left: 0;
25
+ top: 0;
26
+ width: v-bind('style.width');
27
+ height: 20;
28
+ }
29
+ </style>
@@ -1,27 +1,62 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-06-02 13:31:00
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 13:40:15
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2023-02-13 14:30:06
6
6
  * @Description: file content
7
7
  -->
8
- <script>
9
- import { router } from "./router";
10
- import { jJsvRuntimeBridge } from "jsview";
8
+ <script setup>
9
+ import { shallowRef, onMounted } from "vue";
10
+ import { JsvPreload, buildPreloadInfo, jJsvRuntimeBridge } from "jsview";
11
+
12
+ let backgroundImageUrl = shallowRef(null);
13
+
14
+ let preloadInfo = shallowRef([]);
15
+
16
+ let _onPreloadDone = () => {
17
+ console.log("background load done");
18
+ jJsvRuntimeBridge.notifyPageLoaded();
19
+ };
20
+
21
+ onMounted(() => {
22
+ console.log("simulate async get background url");
23
+ setTimeout(() => {
24
+ console.log("simulate background url got");
25
+ backgroundImageUrl.value =
26
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg";
27
+ preloadInfo.value = [buildPreloadInfo(backgroundImageUrl.value)];
28
+ }, 0);
29
+ });
30
+ </script>
11
31
 
32
+ <script>
33
+ import { router } from "./router.js";
12
34
  export default {
13
35
  Router: router,
14
- mounted() {
15
- jJsvRuntimeBridge.notifyPageLoaded();
16
- },
17
36
  };
18
37
  </script>
19
38
 
20
39
  <template>
21
40
  <div>
22
- <router-view />
41
+ <jsv-preload
42
+ :key="backgroundImageUrl"
43
+ :preloadList="preloadInfo"
44
+ :onPreloadDone="_onPreloadDone"
45
+ />
46
+ <div
47
+ :style="{
48
+ width: 1280,
49
+ height: 720,
50
+ backgroundImage: backgroundImageUrl,
51
+ }"
52
+ />
53
+ <router-view v-slot="{ Component, route }">
54
+ <keep-alive>
55
+ <component v-if="route.meta.keepAlive" :is="Component" />
56
+ </keep-alive>
57
+ <component v-if="!route.meta.keepAlive" :is="Component" />
58
+ </router-view>
23
59
  </div>
24
60
  </template>
25
61
 
26
- <style scoped>
27
- </style>
62
+ <style scoped></style>
@@ -62,33 +62,33 @@ export default {
62
62
 
63
63
  <style scoped>
64
64
  .focus {
65
- top: -5px;
66
- left: -5px;
67
- width: 100px;
68
- height: 50px;
65
+ top: -5;
66
+ left: -5;
67
+ width: 100;
68
+ height: 50;
69
69
  background-color: #0000ff;
70
70
  }
71
71
 
72
72
  .normal {
73
- width: 90px;
74
- height: 40px;
73
+ width: 90;
74
+ height: 40;
75
75
  color: #ffffff;
76
76
  text-align: center;
77
- font-size: 30px;
77
+ font-size: 30;
78
78
  }
79
79
  .background {
80
- left: 0px;
81
- top: 0px;
82
- width: 350px;
83
- height: 200px;
80
+ left: 0;
81
+ top: 0;
82
+ width: 350;
83
+ height: 200;
84
84
  background-color: rgba(0, 0, 0, 0.7);
85
85
  }
86
86
  .message {
87
- top: 20px;
88
- width: 350px;
89
- height: 50px;
87
+ top: 20;
88
+ width: 350;
89
+ height: 50;
90
90
  color: #ffffff;
91
- font-size: 40px;
91
+ font-size: 40;
92
92
  text-align: center;
93
93
  }
94
94
  </style>
@@ -7,12 +7,20 @@ const routeList = [
7
7
  name: 'Home',
8
8
  path: '/',
9
9
  component: () => import('./views/Homepage.vue'),
10
+ meta: {
11
+ keepAlive: true // 需要被缓存(测试Router keep alive机制)
12
+ }
10
13
  },
11
14
  {
12
15
  name: '基础示例合集',
13
16
  path: '/feature/Basic',
14
17
  component: () => import('jsview-vue-samples/Basic/App.vue'),
15
18
  },
19
+ {
20
+ name: 'CSS预处理',
21
+ path: '/feature/CssPreprocessor',
22
+ component: () => import('jsview-vue-samples/CssPreprocessor/App.vue'),
23
+ },
16
24
  {
17
25
  name: '可视化变化通知',
18
26
  path: '/feature/VisibleSensorDemo',
@@ -136,7 +144,7 @@ const routeList = [
136
144
  },
137
145
  {
138
146
  name: '公祭日黑白效果',
139
- path: '/feature/FilterDemo',
147
+ path: '/feature/GrayDown',
140
148
  component: () => import('jsview-vue-samples/FilterDemo/App.vue'),
141
149
  },
142
150
  {
@@ -150,20 +158,20 @@ const routeList = [
150
158
  component: () => import('jsview-vue-samples/ScaleDownNeon/App.vue'),
151
159
  },
152
160
  {
153
- name: '轮播图',
161
+ name: '碰撞检测',
162
+ path: '/feature/Collision',
163
+ component: () => import('jsview-vue-samples/Collision/App.vue'),
164
+ },
165
+ {
166
+ name: '碰撞即停',
167
+ path: '/feature/ImpactStop',
168
+ component: () => import('jsview-vue-samples/ImpactStop/App.vue'),
169
+ },
170
+ {
171
+ name: '滚动图',
154
172
  path: '/feature/Swiper',
155
173
  component: () => import('jsview-vue-samples/Swiper/App.vue'),
156
174
  },
157
- // {
158
- // name: '碰撞检测',
159
- // path: '/feature/Collision',
160
- // component: () => import('jsview-vue-samples/Collision/App'),
161
- // },
162
- // {
163
- // name: '碰撞即停',
164
- // path: '/feature/ImpactStop',
165
- // component: () => import('jsview-vue-samples/ImpactStop/App'),
166
- // },
167
175
 
168
176
  // MetroWidget示例
169
177
  {
@@ -1,10 +1,13 @@
1
- <script>
2
- import { jJsvRuntimeBridge, EdgeDirection } from "jsview";
1
+ <script setup>
2
+ import { computed, shallowRef, onActivated } from "vue";
3
+ import { jJsvRuntimeBridge, EdgeDirection, useFocusHub } from "jsview";
3
4
  import TabFrame from "../components/TabFrame.vue";
4
5
  import BodyFrame from "../components/BodyFrame.vue";
5
6
  import Dialog from "../components/Dialog.vue";
6
7
  import { routeList } from "../router.js";
7
8
 
9
+ const isDevelopment = process.env.NODE_ENV !== 'production';
10
+
8
11
  const colorTemplete = ["#89BEB2", "#C9BA83", "#DED38C", "#DE9C53"];
9
12
 
10
13
  const featureData = [];
@@ -27,101 +30,88 @@ for (let item of routeList) {
27
30
  }
28
31
  const dataList = [featureData, metroWidgetData];
29
32
 
30
- export default {
31
- components: {
32
- TabFrame,
33
- Dialog,
34
- BodyFrame,
35
- },
36
- data() {
37
- return {
38
- showExitDialog: false,
39
- contentData: dataList[0],
40
- tabId: 0,
41
- preFocusName: "",
42
- curFocusName: "",
43
- isDevelopment: process.env.NODE_ENV !== 'production',
44
- };
45
- },
46
- setup() {
47
- return {
48
- name: "/home",
49
- };
50
- },
51
- computed: {
52
- address() {
53
- return window.localStorage.href;
54
- },
55
- },
56
- methods: {
57
- onFocus() {
58
- this.changeFocus(this.name + "/bodyFrame");
59
- },
60
- onKeyDown(ev) {
61
- // 处理返回键
62
- if (
63
- ev.keyCode == 8 || // Backspace
64
- ev.keyCode == 27 || // Escape
65
- ev.keyCode == 10000 // 盒子返回键
66
- ) {
67
- this.showExitDialog = !this.showExitDialog;
68
- if (!this.showExitDialog) {
69
- this.changeFocus(this.preFocusName);
70
- } else {
71
- this.preFocusName = this.curFocusName;
72
- this.curFocusName = this.name + "/exitDialog";
73
- }
74
- }
75
- return true;
76
- },
77
- changeFocus(name) {
78
- this.preFocusName = this.curFocusName;
79
- this.curFocusName = name;
80
- this.$refs.rootNode.findBlockByName(name).requestFocus();
81
- },
82
- onTabEdge(edgeInfo) {
83
- if (edgeInfo.direction === EdgeDirection.bottom) {
84
- this.changeFocus(this.name + "/bodyFrame");
85
- }
86
- },
87
- onContentEdge(edgeInfo) {
88
- if (edgeInfo.direction === EdgeDirection.top) {
89
- this.changeFocus(this.name + "/tabFrame");
90
- }
91
- },
92
- tabItemFocus(data) {
93
- if (data.id != this.tabId) {
94
- this.tabId = data.id;
95
- this.contentData = dataList[this.tabId];
96
- }
97
- },
98
- onDialogAction(msg) {
99
- this.showExitDialog = false;
100
- this.changeFocus(this.preFocusName);
101
- switch (msg) {
102
- case "ok":
103
- jJsvRuntimeBridge.closePage();
104
- // if (!window.JsView) {
105
- // // 浏览器调试
106
- // window.location.href = "about:blank";
107
- // }
108
- break;
109
- case "back":
110
- case "cancel":
111
- break;
112
- }
113
- },
114
- },
115
- created() {
116
- if (typeof localStorage.curTab !== "undefined") {
117
- this.tabId = parseInt(localStorage.curTab);
33
+ let showExitDialog = shallowRef(false);
34
+ let contentData = shallowRef(dataList[0]);
35
+ let tabId = shallowRef(0);
36
+
37
+ let preFocusName = "";
38
+ let curFocusName = "";
39
+ let name = "/home";
40
+
41
+ let focusHub = useFocusHub();
42
+
43
+ let address = computed(() => {
44
+ return window.localStorage.href;
45
+ });
46
+
47
+ let onFocus = () => {
48
+ changeFocus(name + "/bodyFrame");
49
+ };
50
+
51
+ let onKeyDown = (ev) => {
52
+ // 处理返回键
53
+ if (
54
+ ev.keyCode == 8 || // Backspace
55
+ ev.keyCode == 27 || // Escape
56
+ ev.keyCode == 10000 // 盒子返回键
57
+ ) {
58
+ showExitDialog.value = !showExitDialog.value;
59
+ if (!showExitDialog.value) {
60
+ changeFocus(preFocusName);
61
+ } else {
62
+ preFocusName = curFocusName;
63
+ curFocusName = name + "/exitDialog";
118
64
  }
119
- localStorage.curTab = 0;
120
- this.contentData = dataList[this.tabId];
121
- },
122
- mounted() {},
123
- beforeUnmount() {},
65
+ }
66
+ return true;
67
+ };
68
+
69
+ let changeFocus = (name) => {
70
+ preFocusName = curFocusName;
71
+ curFocusName = name;
72
+ focusHub.setFocus(name);
73
+ };
74
+
75
+ let onTabEdge = (edgeInfo) => {
76
+ if (edgeInfo.direction === EdgeDirection.bottom) {
77
+ changeFocus(name + "/bodyFrame");
78
+ }
79
+ };
80
+
81
+ let onContentEdge = (edgeInfo) => {
82
+ if (edgeInfo.direction === EdgeDirection.top) {
83
+ changeFocus(name + "/tabFrame");
84
+ }
85
+ };
86
+
87
+ let tabItemFocus = (data) => {
88
+ if (data.id != tabId.value) {
89
+ tabId.value = data.id;
90
+ contentData.value = dataList[data.id];
91
+ }
92
+ };
93
+
94
+ let onDialogAction = (msg) => {
95
+ showExitDialog.value = false;
96
+ changeFocus(preFocusName);
97
+ switch (msg) {
98
+ case "ok":
99
+ jJsvRuntimeBridge.closePage();
100
+ // if (!window.JsView) {
101
+ // // 浏览器调试
102
+ // window.location.href = "about:blank";
103
+ // }
104
+ break;
105
+ case "back":
106
+ case "cancel":
107
+ break;
108
+ }
124
109
  };
110
+
111
+ // keep-alive后 router 返回本页面时要激活一下focus
112
+ onActivated(() => {
113
+ onFocus();
114
+ });
125
115
  </script>
126
116
 
127
117
  <template>
@@ -133,7 +123,6 @@ export default {
133
123
 
134
124
  <jsv-focus-block
135
125
  autoFocus
136
- ref="rootNode"
137
126
  :onAction="{
138
127
  onKeyDown: onKeyDown,
139
128
  onFocus: onFocus,
@@ -173,24 +162,23 @@ export default {
173
162
 
174
163
  <style scoped>
175
164
  .rootSize {
176
- width: 1280;
177
- height: 720;
178
- background-color: #334c4c;
165
+ width: 1920;
166
+ height: 1080;
179
167
  }
180
168
 
181
169
  .address {
182
170
  width: 1280;
183
171
  height: 30;
184
172
  color: #ffffff;
185
- font-size: 20px;
173
+ font-size: 20;
186
174
  }
187
175
 
188
176
  .logo {
189
177
  top: 10;
190
- width: 1250;
178
+ width: 1260;
191
179
  height: 30;
192
180
  color: #00ff00;
193
- font-size: 20px;
181
+ font-size: 20;
194
182
  font-weight: bold;
195
183
  text-align: right;
196
184
  }
@@ -0,0 +1,150 @@
1
+ <script>
2
+ import { Options, Vue } from "vue-class-component";
3
+ import { data1, data2, data3 } from "./data";
4
+ import GridPlate from "./utils/GridPlate.vue";
5
+ import Item from "./components/ContentItem.vue";
6
+ import MyTab from "./components/MyTab.vue";
7
+
8
+ @Options({
9
+ components: {
10
+ GridPlate,
11
+ Item,
12
+ MyTab,
13
+ },
14
+ })
15
+ class App extends Vue {
16
+ constructor(props) {
17
+ super(props);
18
+ this.focusNode = null;
19
+ this.contentData = data1;
20
+ this.myId = 0;
21
+ this.focusStyle = {};
22
+ this.requestDataTime = 0;
23
+
24
+ window.sStyleChangeCount = 0;
25
+ window.sStyleChangeCost = 0;
26
+ window.sStyleTextChangeCost = 0;
27
+
28
+ window.sStylePropCount = 0;
29
+ window.sStylePropCost = 0;
30
+
31
+ console.log("App created");
32
+ }
33
+
34
+ onKeyDown(ev) {
35
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
36
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
37
+ this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
38
+ return true;
39
+ }
40
+ return false;
41
+ }
42
+
43
+ getMeasures() {
44
+ return {
45
+ width: 227,
46
+ height: 351,
47
+ focusable: true,
48
+ };
49
+ }
50
+ onFocus() {
51
+ console.log("App onFocus", this.$refs.rootNode);
52
+ }
53
+ onItemFocus(id) {
54
+ if (this.requestDataTime != 0) {
55
+ clearTimeout(this.requestDataTime);
56
+ this.requestDataTime = 0;
57
+ }
58
+ // this.requestDataTime = setTimeout(()=>{
59
+ if (!window.JsvDebugTimeToken) {
60
+ window.JsvDebugTimeToken = {
61
+ start: 0,
62
+ };
63
+ }
64
+ window.JsvDebugTimeToken.start = Date.now();
65
+ console.log(
66
+ "JsvTestTime onItemFocus start time=" + window.JsvDebugTimeToken.start
67
+ );
68
+
69
+ window.sStyleChangeCount = 0;
70
+ window.sStyleChangeCost = 0;
71
+ window.sStyleTextChangeCost = 0;
72
+ window.sStylePropCount = 0;
73
+ window.sStylePropCost = 0;
74
+
75
+ switch (id) {
76
+ case 0:
77
+ this.contentData = data1;
78
+ break;
79
+ case 1:
80
+ this.contentData = data2;
81
+ break;
82
+ case 2:
83
+ this.contentData = data3;
84
+ break;
85
+ }
86
+ this.myId = id;
87
+ // }, 0);
88
+ }
89
+
90
+ beforeUnmount() {
91
+ if (this.requestDataTime != 0) {
92
+ clearTimeout(this.requestDataTime);
93
+ this.requestDataTime = 0;
94
+ }
95
+ }
96
+
97
+ mounted() {
98
+ this.$refs.rootNode.findBlockByName("tab").requestFocus();
99
+ window.jJsvRuntimeBridge?.notifyPageLoaded();
100
+ }
101
+ }
102
+
103
+ export default App;
104
+ </script>
105
+
106
+ <template>
107
+ <jsv-focus-block
108
+ ref="rootNode"
109
+ autoFocus
110
+ :onKeyDown="onKeyDown"
111
+ :onFocus="onFocus"
112
+ >
113
+ <div class="rootSize">
114
+ <div :style="{ left: 50, top: 50 }">
115
+ <my-tab name="tab" :onItemFocus="onItemFocus" />
116
+ </div>
117
+
118
+ <div class="widgetPos">
119
+ <grid-plate
120
+ name="simpleWidget"
121
+ :key="myId"
122
+ :data="contentData"
123
+ :width="1253"
124
+ :height="600"
125
+ :measures="getMeasures"
126
+ >
127
+ <template #renderItem="{ data }">
128
+ <Item :data="data" />
129
+ </template>
130
+ </grid-plate>
131
+ </div>
132
+ </div>
133
+ </jsv-focus-block>
134
+ </template>
135
+
136
+ <style scoped>
137
+ .rootSize {
138
+ top: 0;
139
+ }
140
+
141
+ .widgetPos {
142
+ top: 120;
143
+ left: 50;
144
+ }
145
+
146
+ .focusPos {
147
+ top: 10;
148
+ left: 10;
149
+ }
150
+ </style>