@shijiu/jsview-vue-samples 1.9.747

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 (213) hide show
  1. package/AnimPicture/App.vue +207 -0
  2. package/AnimPicture/assets/animated_webp.webp +0 -0
  3. package/AnimPicture/assets/ball_3.webp +0 -0
  4. package/AnimPicture/assets/girl_run.gif +0 -0
  5. package/AnimPicture/assets/quan.webp +0 -0
  6. package/Basic/App.vue +134 -0
  7. package/Basic/assets/border.png +0 -0
  8. package/Basic/assets/border2.png +0 -0
  9. package/Basic/assets/icon.png +0 -0
  10. package/Basic/assets/test.jpg +0 -0
  11. package/Basic/components/ContentBlock.vue +38 -0
  12. package/Basic/components/FontStyle.css +16 -0
  13. package/Basic/components/anim/AnimGroup.vue +66 -0
  14. package/Basic/components/anim/AnimKeyframeBasic.vue +119 -0
  15. package/Basic/components/anim/AnimKeyframeComposite.vue +52 -0
  16. package/Basic/components/anim/AnimTransition.vue +157 -0
  17. package/Basic/components/div/DivBackground.vue +44 -0
  18. package/Basic/components/div/DivClip.vue +159 -0
  19. package/Basic/components/div/DivCssScoped.vue +20 -0
  20. package/Basic/components/div/DivCssVar.vue +53 -0
  21. package/Basic/components/div/DivGroup1.vue +47 -0
  22. package/Basic/components/div/DivGroup2.vue +65 -0
  23. package/Basic/components/div/DivLayout.vue +70 -0
  24. package/Basic/components/div/DivRadius.vue +65 -0
  25. package/Basic/components/div/DivTransform.vue +32 -0
  26. package/Basic/components/img/ImageGroup.vue +31 -0
  27. package/Basic/components/img/ImgLayout.vue +41 -0
  28. package/Basic/components/panel/Panel1.vue +55 -0
  29. package/Basic/components/panel/Panel2.vue +31 -0
  30. package/Basic/components/panel/TitleBar.vue +29 -0
  31. package/Basic/components/text/TextAlign.vue +66 -0
  32. package/Basic/components/text/TextEmoji.vue +26 -0
  33. package/Basic/components/text/TextFontStyle.vue +89 -0
  34. package/Basic/components/text/TextGroup1.vue +49 -0
  35. package/Basic/components/text/TextGroup2.vue +28 -0
  36. package/Basic/components/text/TextOverflow.vue +110 -0
  37. package/BasicFocusControl/App.vue +104 -0
  38. package/BasicFocusControl/components/BaseBlock.vue +50 -0
  39. package/BasicFocusControl/components/MainArea.vue +83 -0
  40. package/BasicFocusControl/components/MainAreaLeftBlock.vue +17 -0
  41. package/BasicFocusControl/components/MainAreaRightBlock.vue +27 -0
  42. package/BasicFocusControl/components/SideBar.vue +58 -0
  43. package/BasicFocusControl/components/SideBarBlock.vue +27 -0
  44. package/Collision/App.vue +452 -0
  45. package/ColorSpace/App.vue +126 -0
  46. package/ColorSpace/bmpDemo.bmp +0 -0
  47. package/ColorSpace/jpegDemo.jpeg +0 -0
  48. package/ColorSpace/pngDemo.png +0 -0
  49. package/ColorSpace/pngNoAlphaDemo.png +0 -0
  50. package/DemoHomepage/App.vue +27 -0
  51. package/DemoHomepage/components/BodyFrame.vue +95 -0
  52. package/DemoHomepage/components/Dialog.vue +94 -0
  53. package/DemoHomepage/components/Item.vue +77 -0
  54. package/DemoHomepage/components/TabFrame.vue +85 -0
  55. package/DemoHomepage/router.js +196 -0
  56. package/DemoHomepage/views/Homepage.vue +195 -0
  57. package/FilterDemo/AnimatePic.vue +58 -0
  58. package/FilterDemo/App.vue +159 -0
  59. package/FilterDemo/VideoLayer.vue +62 -0
  60. package/FilterDemo/jpegDemo.jpeg +0 -0
  61. package/FilterDemo/webpDemo.webp +0 -0
  62. package/FlipCard/App.vue +71 -0
  63. package/FlipCard/FlipCard.vue +118 -0
  64. package/FlipCard/assets/blue_egg.png +0 -0
  65. package/FlipCard/assets/red_egg.png +0 -0
  66. package/FlipCard/data.js +13 -0
  67. package/GridDemo/App.vue +215 -0
  68. package/GridDemo/ButtonBlock.vue +112 -0
  69. package/GridDemo/FocusItem.vue +37 -0
  70. package/GridDemo/Item.vue +93 -0
  71. package/HashHistory/App.vue +115 -0
  72. package/HashHistory/components/HorizontalButtonList.vue +91 -0
  73. package/HashHistory/components/Item.vue +60 -0
  74. package/HashHistory/router.js +41 -0
  75. package/HashHistory/views/MainPage.vue +57 -0
  76. package/HashHistory/views/SubPage.vue +66 -0
  77. package/ImpactStop/App.vue +435 -0
  78. package/Input/App.vue +164 -0
  79. package/Input/FullKeyboard.vue +87 -0
  80. package/Input/InputPanel.vue +131 -0
  81. package/Input/KeyboardItem.vue +58 -0
  82. package/LongImage/App.vue +80 -0
  83. package/LongImage/Button.vue +58 -0
  84. package/LongImage/ButtonItem.vue +44 -0
  85. package/LongImage/LongImageScroll.vue +92 -0
  86. package/LongImage/Scroll.vue +14 -0
  87. package/LongImage/assets/1280x7200.jpg +0 -0
  88. package/LongText/App.vue +96 -0
  89. package/LongText/Button.vue +51 -0
  90. package/LongText/ButtonItem.vue +44 -0
  91. package/LongText/LongTextScroll.vue +192 -0
  92. package/LongText/Scroll.vue +14 -0
  93. package/Marquee/App.vue +247 -0
  94. package/Marquee/longText.js +14 -0
  95. package/MaskClip/App.vue +122 -0
  96. package/MaskClip/images/mask-025/config.json +29 -0
  97. package/MaskClip/images/mask-025/res/1.png +0 -0
  98. package/MaskClip/images/mask-025/res/2.png +0 -0
  99. package/MaskClip/images/mask-025/res/3.png +0 -0
  100. package/MaskClip/images/mask-025/res/4.png +0 -0
  101. package/MaskClip/images/mask-025/res/icon.png +0 -0
  102. package/MaskClip/images/mask-025/res/stroke.png +0 -0
  103. package/MaskClip/images/php.jpg +0 -0
  104. package/MetroWidgetDemos/Advanced/App.vue +46 -0
  105. package/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
  106. package/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
  107. package/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
  108. package/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  109. package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  110. package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +116 -0
  111. package/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  112. package/MetroWidgetDemos/Item.vue +85 -0
  113. package/MetroWidgetDemos/PerformanceTest/App.vue +210 -0
  114. package/MetroWidgetDemos/PerformanceTest/Item.vue +90 -0
  115. package/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
  116. package/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
  117. package/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
  118. package/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
  119. package/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
  120. package/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
  121. package/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
  122. package/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
  123. package/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
  124. package/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
  125. package/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
  126. package/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
  127. package/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
  128. package/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
  129. package/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
  130. package/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
  131. package/MetroWidgetDemos/PerformanceTest/border.png +0 -0
  132. package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +386 -0
  133. package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +129 -0
  134. package/MetroWidgetDemos/PerformanceTest/data.js +45 -0
  135. package/MetroWidgetDemos/PingPong/App.vue +135 -0
  136. package/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
  137. package/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
  138. package/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
  139. package/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
  140. package/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
  141. package/MetroWidgetDemos/Simple/App.vue +45 -0
  142. package/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
  143. package/MetroWidgetDemos/WidgetItem.vue +89 -0
  144. package/MetroWidgetDemos/data.js +205 -0
  145. package/NinePatchDemo/App.vue +145 -0
  146. package/NinePatchDemo/Item.vue +69 -0
  147. package/NinePatchDemo/assets/border.png +0 -0
  148. package/Preload/App.vue +135 -0
  149. package/Preload/Item.vue +32 -0
  150. package/Preload/data.js +23 -0
  151. package/Preload/images/awesomeface.png +0 -0
  152. package/Preload/images/cat.jpg +0 -0
  153. package/Preload/images/rank.png +0 -0
  154. package/Preload/images/rank_focus.png +0 -0
  155. package/Preload/images/rule.png +0 -0
  156. package/Preload/images/rule_focus.png +0 -0
  157. package/Preload/images/start.png +0 -0
  158. package/Preload/images/start_focus.png +0 -0
  159. package/QrcodeDemo/App.vue +68 -0
  160. package/ScaleDownNeon/App.vue +107 -0
  161. package/SoundPool/App.vue +134 -0
  162. package/SoundPool/bgmusic.mp3 +0 -0
  163. package/SoundPool/coin.mp3 +0 -0
  164. package/SoundPool/jump.mp3 +0 -0
  165. package/SoundPool/lose.mp3 +0 -0
  166. package/SoundPool/run.mp3 +0 -0
  167. package/SprayView/App.vue +272 -0
  168. package/SprayView/assets/snow.png +0 -0
  169. package/SpriteImage/App.vue +173 -0
  170. package/SpriteImage/images/cat_run.png +0 -0
  171. package/SpriteImage/images/egg_break.json +116 -0
  172. package/SpriteImage/images/egg_break.png +0 -0
  173. package/SpriteImage/images/sprite.png +0 -0
  174. package/TextBox/App.vue +91 -0
  175. package/TextBox/RenderCenter.vue +133 -0
  176. package/TextBox/RenderLeft.vue +138 -0
  177. package/TextBox/RenderOneLine.vue +101 -0
  178. package/TextBox/RenderRight.vue +131 -0
  179. package/TextShadowDemo/App.vue +91 -0
  180. package/TextureAnimation/App.vue +336 -0
  181. package/TextureAnimation/App2.vue +111 -0
  182. package/TextureAnimation/assets/blackWhiteGrid.png +0 -0
  183. package/TextureAnimation/assets/light.png +0 -0
  184. package/TextureAnimation/assets/light2.png +0 -0
  185. package/TextureAnimation/assets/mask.png +0 -0
  186. package/TextureAnimation/assets/php.jpg +0 -0
  187. package/TextureAnimation/assets/php2.png +0 -0
  188. package/TextureAnimation/assets/swipLight.png +0 -0
  189. package/TextureSize/App.vue +132 -0
  190. package/TextureSize/bmpDemo.bmp +0 -0
  191. package/TextureSize/jpegDemo.jpeg +0 -0
  192. package/TextureSize/jpgDemo.jpg +0 -0
  193. package/TextureSize/pngDemo.png +0 -0
  194. package/TextureSize/pngNoAlphaDemo.png +0 -0
  195. package/ThrowMoveDemo/AccelerateDemo.vue +116 -0
  196. package/ThrowMoveDemo/App.vue +114 -0
  197. package/ThrowMoveDemo/LRParabolicDemo.vue +115 -0
  198. package/ThrowMoveDemo/TargetDemo.vue +116 -0
  199. package/ThrowMoveDemo/UDParabolicDemo.vue +121 -0
  200. package/TouchSample/App.vue +136 -0
  201. package/TouchSample/Item.vue +103 -0
  202. package/TouchSample/MetroWidgetHorizontal.vue +144 -0
  203. package/TouchSample/MetroWidgetVertical.vue +144 -0
  204. package/TouchSample/TouchContainerHorizontal.vue +160 -0
  205. package/TouchSample/TouchContainerVertical.vue +160 -0
  206. package/TouchSample/data.js +81 -0
  207. package/TransitPage/App.vue +29 -0
  208. package/VideoDemo/App.vue +121 -0
  209. package/VideoDemo/components/Button.vue +58 -0
  210. package/VideoDemo/components/Controllor.vue +197 -0
  211. package/VideoDemo/components/VideoFrame.vue +140 -0
  212. package/VisibleSensorDemo/App.vue +234 -0
  213. package/package.json +17 -0
@@ -0,0 +1,104 @@
1
+ <!--
2
+ * 【界面概述】
3
+ * 用于展示FDiv控件来进行按键响应区块划分的样例。
4
+ * 界面分为主界面(main)和副界面(sideBar),当主界面右边缘再按下右键时,焦点跳到SiderBar区域,
5
+ * 同理,焦点在SiderBar中,按下左键时,焦点调回main区域。
6
+ * 除此外,为区域内焦点移动。
7
+ *
8
+ * 【控件介绍】
9
+ * Fdiv:焦点控制节点,可由继承自FdivWrapper或者enableFocusable(基础类)生成衍生类两种方式获得
10
+ * 属性(props):
11
+ * style {Object} 同div的style设置
12
+ * branchName {string} 焦点名称,用于changeFocus()函数进行焦点切换的id
13
+ *
14
+ * FdivWrapper方式的类接口列表:
15
+ * onKeyDown(ev) ev的结构为{keyCode:按键值, repeat:是否是重复按键},响应按键按下事件,
16
+ * 返回值为true时,父节点的onKeyDown不会再被触发
17
+ * onKeyUp(ev) ev的结构同上,响应按键抬起事件
18
+ * onDispatchKeyDown(ev) ev的结构同上,响应按键按下事件,返回值为true时,子节点的onDispatchKeyDown不会被触发
19
+ * onDispatchKeyUp(ev) ev的结构同上,响应按键抬起事件
20
+ * onFocus() 当被changeFocus改变焦点后,该节点获焦时被调用
21
+ * onBlur() 当被changeFocus改变焦点后,该节点丢失焦点时被调用
22
+ * renderContent() 替代render()函数,返回控件描绘内容
23
+ * changeFocus(branchName, keepChildFocus) 主动进行焦点切换
24
+ *
25
+ * enableFocusable(基础类)生成衍生类时的节点列表:
26
+ * onKeyDown(ev) 同上
27
+ * onKeyUp(ev) 同上
28
+ * onDispatchKeyDown(ev) 同上
29
+ * onDispatchKeyUp(ev) 同上
30
+ * onFocus(ev) 同上
31
+ * onBlur(ev) 同上
32
+ * setControl(control_ref) 接受control对象,control对象含有changeFocus接口
33
+ * changeFocus(branchName) 同上
34
+ * 注意: render()函数没有被renderContent()函数替代
35
+ *
36
+ * 【技巧说明】
37
+ * Q: 如何进行按键响应?
38
+ * A: 重载函数onKeyDown/onKeyUp/onDispatchKeyDown/onDispatchKeyUp中任何一个关心的按键事件响应函数,
39
+ * 处理ev.keyCode判断按键值,通过返回值控制消息传递链是否中止
40
+ *
41
+ * Q: 如何进行焦点切换?
42
+ * A: 首先为子焦点设置branchName属性,当需要进行焦点切换的时候,调用FDiv类中的this.changeFocus()接口,
43
+ * 传入目标的branchName,即可进行焦点切换。在同一个FdivRouter节点的所有Fdiv,只要指定对方的branchName,就可以进行切换。
44
+ * 不限制切换目标是自己的子节点、兄弟节点或者是父几点。一般一个场景定义一个FdivRouter。
45
+ * 在enableFocusable的场景,通过重载setControl接口,获得control对象,通过该对象的 changeFocus()接口来进行焦点切换。
46
+ *
47
+ * Q: changeFocus的第二个参数keepChildFocus的作用是什么?
48
+ * A: 使用场景举例:
49
+ * 场景1:changeFocus的目标是一个当前获焦节点的父节点时,若keepChildFocus为true,则不会发生任何改变;
50
+ * 若keepChildFocus为false或者不设置,则该焦点会失焦,焦点退回到父节点中。
51
+ * 场景2:changeFocus的目标为一个曾经获得过焦但目前处于非焦状态的节点的父节点时,若keepChildFocus为true时,
52
+ * 焦点会沿着该父节点的最后获焦状态记录,寻找到最末尾的落焦节点进行获焦;若keepChildFocus为false或者不设置,
53
+ * 则只会对该父节点进行获焦,不会根据最后获焦状态寻找最末尾节点。
54
+ * (例如,进行场景回退时,返回上一个场景过程中,不需要该场景去记录最后的焦点位置,只要changeFocus设置
55
+ * 为该场景的根Fdiv,并且keepChildFocus设置为true,则Fdiv系统会自动将焦点落在此场景失焦时的最后获焦位置。)
56
+ *
57
+ -->
58
+
59
+ <script setup>
60
+ import { useRouter } from "vue-router";
61
+ import MainArea from "./components/MainArea.vue";
62
+ import SideBar from "./components/SideBar.vue";
63
+
64
+ const router = useRouter();
65
+ const onKeyDown = (ev) => {
66
+ // 有router时,是从DemoHomepage进入,回退,和本demo功能无关
67
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
68
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
69
+ router.go(-1);
70
+ return true;
71
+ }
72
+ return false;
73
+ };
74
+ </script>
75
+
76
+ <template>
77
+ <!-- 这里的jsv-focus-block只是为了获取到一个base focus节点,并不是必须的 -->
78
+ <jsv-focus-block :onKeyDown="onKeyDown">
79
+ <div class="title">可上下左右切换焦点</div>
80
+ <div class="body">
81
+ <MainArea :style="{ left: 0 }" />
82
+ <SideBar :style="{ left: 300 }" />
83
+ </div>
84
+ </jsv-focus-block>
85
+ </template>
86
+
87
+ <style scoped>
88
+ .title {
89
+ text-align: center;
90
+ font-size: 30px;
91
+ line-height: 50px;
92
+ color: #ffffff;
93
+ left: 100;
94
+ top: 50;
95
+ width: 400;
96
+ height: 50;
97
+ background-color: rgba(27, 38, 151, 0.8);
98
+ }
99
+
100
+ .body {
101
+ left: 100;
102
+ top: 120;
103
+ }
104
+ </style>
@@ -0,0 +1,50 @@
1
+ <script setup>
2
+ import { ref, shallowRef, onMounted } from "vue";
3
+ const props = defineProps({
4
+ name: String,
5
+ style: {
6
+ type: Object,
7
+ default() {
8
+ return {};
9
+ },
10
+ },
11
+ onKeyDown: Function,
12
+ });
13
+
14
+ const fullName = ref("");
15
+ const blockRef = shallowRef(null);
16
+ const hasFocused = ref(false);
17
+
18
+ onMounted(() => {
19
+ fullName.value = blockRef.value.getName();
20
+ });
21
+ const onFocus = () => {
22
+ hasFocused.value = true;
23
+ };
24
+ const onBlur = () => {
25
+ hasFocused.value = false;
26
+ };
27
+ </script>
28
+
29
+ <template>
30
+ <jsv-focus-block
31
+ ref="blockRef"
32
+ :name="name"
33
+ :onAction="{
34
+ onKeyDown,
35
+ onFocus,
36
+ onBlur,
37
+ }"
38
+ >
39
+ <div
40
+ :style="{
41
+ ...$props.style,
42
+ width: 100,
43
+ height: 100,
44
+ backgroundColor: hasFocused ? 'rgba(255,0,0,1)' : 'rgba(0,255,0,1)',
45
+ }"
46
+ >
47
+ {{ fullName }}
48
+ </div>
49
+ </jsv-focus-block>
50
+ </template>
@@ -0,0 +1,83 @@
1
+ <script setup>
2
+ import MainAreaLeftBlock from "./MainAreaLeftBlock.vue";
3
+ import MainAreaRightBlock from "./MainAreaRightBlock.vue";
4
+ import { useFocusHub } from "jsview";
5
+
6
+ const focusHub = useFocusHub();
7
+ window.focusHub = focusHub
8
+ let focusRow = 0;
9
+ let focusColumn = 0;
10
+ const onKeyDown = (ev) => {
11
+ // 子节点未处理的按键事件会流向此节点
12
+ let keyUsed = true;
13
+ switch (ev.keyCode) {
14
+ case 38: // Up
15
+ focusRow = 0;
16
+ break;
17
+ case 40: // Down
18
+ focusRow = 1;
19
+ break;
20
+ case 37: // Left
21
+ focusColumn = 0;
22
+ break;
23
+ case 39: // Right
24
+ focusColumn = 1;
25
+ break;
26
+ default:
27
+ keyUsed = false;
28
+ }
29
+
30
+ if (keyUsed) {
31
+ // 焦点与之前相同时也可以重复调用,焦点管理系统内容有是否变更的判断处理
32
+ const name = `main.R${focusRow}C${focusColumn}`;
33
+ focusHub.setFocus(name);
34
+ }
35
+
36
+ return keyUsed;
37
+ };
38
+
39
+ const onFocus = () => {
40
+ const name = `main.R${focusRow}C${focusColumn}`;
41
+ focusHub.setFocus(name);
42
+ };
43
+ </script>
44
+
45
+ <template>
46
+ <!--jsv-focus-block是不可描画节点,所以如果想接收style等属性,不要放在顶级-->
47
+ <div>
48
+ <!-- 这里的jsv-focus-block只是一个namesapce的样例,并不是必须的,
49
+ 如果你App中的焦点在一个命名空间下,这里可以用name,参考SideBar。 -->
50
+ <jsv-focus-block
51
+ namespace="main"
52
+ autoFocus
53
+ :onAction="{
54
+ onKeyDown,
55
+ onFocus,
56
+ }"
57
+ >
58
+ <MainAreaLeftBlock name="R0C0" :style="{ left: 0, top: 0 }" />
59
+ <MainAreaLeftBlock name="R1C0" :style="{ left: 0, top: 120 }" />
60
+ <MainAreaRightBlock name="R0C1" :style="{ left: 120, top: 0 }" />
61
+ <MainAreaRightBlock name="R1C1" :style="{ left: 120, top: 120 }" />
62
+ </jsv-focus-block>
63
+ </div>
64
+ </template>
65
+
66
+ <style scoped>
67
+ .title {
68
+ text-align: center;
69
+ font-size: 30px;
70
+ line-height: 50px;
71
+ color: #ffffff;
72
+ left: 100;
73
+ top: 50;
74
+ width: 400;
75
+ height: 50;
76
+ background-color: rgba(27, 38, 151, 0.8);
77
+ }
78
+
79
+ .body {
80
+ left: 100;
81
+ top: 120;
82
+ }
83
+ </style>
@@ -0,0 +1,17 @@
1
+ <script setup>
2
+ import BaseBlock from "./BaseBlock.vue";
3
+
4
+ defineProps({
5
+ name: String,
6
+ style: {
7
+ type: Object,
8
+ default() {
9
+ return {};
10
+ },
11
+ },
12
+ });
13
+ </script>
14
+
15
+ <template>
16
+ <BaseBlock :name="name" :style="style" />
17
+ </template>
@@ -0,0 +1,27 @@
1
+ <script setup>
2
+ import BaseBlock from "./BaseBlock.vue";
3
+ import { useFocusHub } from "jsview";
4
+ defineProps({
5
+ name: String,
6
+ style: {
7
+ type: Object,
8
+ default() {
9
+ return {};
10
+ },
11
+ },
12
+ });
13
+
14
+ const focusHub = useFocusHub();
15
+ const onKeyDown = (ev) => {
16
+ if (ev.keyCode === 39) {
17
+ // Right key
18
+ focusHub.setFocus("sideBarR0C0");
19
+ return true;
20
+ }
21
+ return false;
22
+ };
23
+ </script>
24
+
25
+ <template>
26
+ <BaseBlock :name="name" :style="style" :onKeyDown="onKeyDown" />
27
+ </template>
@@ -0,0 +1,58 @@
1
+ <script setup>
2
+ import SideBarBlock from "./SideBarBlock.vue";
3
+ import { useFocusHub } from "jsview";
4
+ let focusRow = 0;
5
+ const focusHub = useFocusHub();
6
+
7
+ const onKeyDown = (ev) => {
8
+ // 子节点未处理的按键事件会流向此节点
9
+ let keyUsed = true;
10
+ switch (ev.keyCode) {
11
+ case 38: // Up
12
+ focusRow = 0;
13
+ break;
14
+ case 40: // Down
15
+ focusRow = 1;
16
+ break;
17
+ default:
18
+ keyUsed = false;
19
+ }
20
+
21
+ if (keyUsed) {
22
+ // 焦点与之前相同时也可以重复调用,焦点管理系统内容有是否变更的判断处理
23
+ const name = `sideBarR${focusRow}C0`;
24
+ focusHub.setFocus(name);
25
+ }
26
+
27
+ return keyUsed;
28
+ };
29
+ </script>
30
+
31
+ <template>
32
+ <div>
33
+ <!--jsv-focus-block是非可描画节点,所以如果想接收style等属性,不要放在顶级-->
34
+ <jsv-focus-block :onKeyDown="onKeyDown">
35
+ <SideBarBlock name="sideBarR0C0" :style="{ left: 0, top: 0 }" />
36
+ <SideBarBlock name="sideBarR1C0" :style="{ left: 0, top: 120 }" />
37
+ </jsv-focus-block>
38
+ </div>
39
+ </template>
40
+
41
+ <style scoped>
42
+ .title {
43
+ text-align: center;
44
+ font-size: 30px;
45
+ line-height: 50px;
46
+ color: #ffffff;
47
+ left: 100;
48
+ top: 50;
49
+ width: 400;
50
+ height: 50;
51
+ background-color: rgba(27, 38, 151, 0.8);
52
+ }
53
+
54
+ .body {
55
+ left: 100;
56
+ top: 120;
57
+ }
58
+ </style>
@@ -0,0 +1,27 @@
1
+ <script setup>
2
+ import BaseBlock from "./BaseBlock.vue";
3
+ import { useFocusHub } from "jsview";
4
+
5
+ defineProps({
6
+ name: String,
7
+ style: {
8
+ type: Object,
9
+ default() {
10
+ return {};
11
+ },
12
+ },
13
+ });
14
+ const focusHub = useFocusHub();
15
+ const onKeyDown = (ev) => {
16
+ if (ev.keyCode === 37) {
17
+ // Right key
18
+ focusHub.setFocus("main");
19
+ return true;
20
+ }
21
+ return false;
22
+ };
23
+ </script>
24
+
25
+ <template>
26
+ <BaseBlock :name="name" :style="style" :onKeyDown="onKeyDown" />
27
+ </template>