@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,144 @@
1
+ <script>
2
+ import {
3
+ VERTICAL,
4
+ MetroWidget,
5
+ WholePageSlide,
6
+ SeamlessSlide,
7
+ FixPositionSlide,
8
+ } from "jsview";
9
+
10
+ import Item from "./Item.vue";
11
+
12
+ import { metroWidgetV, measures } from "./data.js";
13
+ import { ref, shallowRef } from "vue";
14
+
15
+ export default {
16
+ components: {
17
+ MetroWidget,
18
+ Item,
19
+ },
20
+ setup() {
21
+ return {
22
+ measures,
23
+ name: "/metroWidgetH",
24
+ direction: VERTICAL,
25
+ wholePageSlide: new WholePageSlide({
26
+ speed: 1.5,
27
+ }),
28
+ seamlessSlide: new SeamlessSlide({
29
+ startPercent: 0.4,
30
+ endPercent: 0.6,
31
+ speed: 0.5,
32
+ }),
33
+ fixPositionSlide: new FixPositionSlide({
34
+ fixPercent: 0.5,
35
+ speed: 0.5,
36
+ }),
37
+ token: ref(0),
38
+ CONST_ITEM_WIDTH: 300,
39
+ CONST_ITEM_HEIGHT: 100,
40
+ };
41
+ },
42
+ methods: {
43
+ _provideData() {
44
+ return metroWidgetV;
45
+ },
46
+ },
47
+
48
+ mounted() {},
49
+ };
50
+ </script>
51
+
52
+ <template>
53
+ <div class="rootSize">
54
+ <div :style="{ width: 1280, height: 720, left: 50, overflow: 'hidden' }">
55
+ <div
56
+ :style="{
57
+ left: 0,
58
+ width: 200,
59
+ height: 40,
60
+ fontSize: 25,
61
+ lineHeight: '40px',
62
+ color: '#fff753',
63
+ }"
64
+ >
65
+ 整页滑动
66
+ </div>
67
+ <div
68
+ :style="{
69
+ left: 200,
70
+ width: CONST_ITEM_WIDTH + 20,
71
+ height: CONST_ITEM_HEIGHT * 5 + 20,
72
+ backgroundColor: '#ff0000',
73
+ }"
74
+ >
75
+ <metro-widget
76
+ name="simpleWidgetVertical1"
77
+ :width="CONST_ITEM_WIDTH + 20"
78
+ :height="CONST_ITEM_HEIGHT * 5 + 20"
79
+ :direction="direction"
80
+ :measures="measures"
81
+ :provideData="_provideData"
82
+ :padding="{ top: 10, left: 10, right: 10, bottom: 10 }"
83
+ :enableTouch="true"
84
+ :flingPageWidth="CONST_ITEM_HEIGHT * 5"
85
+ >
86
+ <template #renderItem="{ data, query, onEdge, onAction }">
87
+ <item
88
+ :data="data"
89
+ :query="query"
90
+ :onEdge="onEdge"
91
+ :onAction="onAction"
92
+ /> </template
93
+ ></metro-widget>
94
+ </div>
95
+ <div
96
+ :style="{
97
+ left: 600,
98
+ width: 200,
99
+ height: 40,
100
+ fontSize: 25,
101
+ lineHeight: '40px',
102
+ color: '#fff753',
103
+ }"
104
+ >
105
+ 普通滑动
106
+ </div>
107
+ <div
108
+ :style="{
109
+ left: 800,
110
+ width: CONST_ITEM_WIDTH + 20,
111
+ height: CONST_ITEM_HEIGHT * 5 + 20,
112
+ backgroundColor: '#ff0000',
113
+ }"
114
+ >
115
+ <metro-widget
116
+ name="simpleWidgetVertical2"
117
+ :width="CONST_ITEM_WIDTH + 20"
118
+ :height="CONST_ITEM_HEIGHT * 5 + 20"
119
+ :direction="direction"
120
+ :measures="measures"
121
+ :provideData="_provideData"
122
+ :padding="{ top: 10, left: 10, right: 10, bottom: 10 }"
123
+ :enableTouch="true"
124
+ >
125
+ <template #renderItem="{ data, query, onEdge, onAction }">
126
+ <item
127
+ :data="data"
128
+ :query="query"
129
+ :onEdge="onEdge"
130
+ :onAction="onAction"
131
+ /> </template
132
+ ></metro-widget>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </template>
137
+
138
+ <style scoped>
139
+ .rootSize {
140
+ width: 1920;
141
+ height: 1080;
142
+ background-color: #334c4c;
143
+ }
144
+ </style>
@@ -0,0 +1,160 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-04-10 21:21:02
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-07-08 14:40:19
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import {
10
+ JsvTouchContainer,
11
+ DIRECTION_VERTICAL,
12
+ DIRECTION_HORIZONTAL,
13
+ DIRECTION_DISABLE,
14
+ } from "jsview";
15
+ import { touchContainerH, measures } from "./data.js";
16
+ function randomColor() {
17
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
18
+ return (
19
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
20
+ );
21
+ }
22
+ export default {
23
+ components: {
24
+ JsvTouchContainer,
25
+ },
26
+ setup() {
27
+ return {
28
+ DIRECTION_VERTICAL,
29
+ DIRECTION_HORIZONTAL,
30
+ DIRECTION_DISABLE,
31
+ touchContainerH,
32
+ measures,
33
+ randomColor,
34
+ };
35
+ },
36
+ methods: {
37
+ _onClick(msg) {
38
+ console.log(`_onClick:${JSON.stringify(msg)}`);
39
+ return true;
40
+ },
41
+ },
42
+ };
43
+ </script>
44
+
45
+ <template>
46
+ <div :style="{ width: 1280, height: 720, overflow: 'hidden' }">
47
+ <jsv-touch-container
48
+ :style="{ width: 1280, height: 720 * 2, backgroundColor: '#7b7a1c' }"
49
+ :direction="DIRECTION_VERTICAL"
50
+ :dragLimitArea="{ x: 0, y: 0, width: 1280, height: 720 }"
51
+ >
52
+ <div
53
+ :style="{
54
+ left: 30,
55
+ top: 0,
56
+ width: 400,
57
+ height: 30,
58
+ fontSize: 18,
59
+ lineHeight: '30px',
60
+ color: '#f0ef29',
61
+ }"
62
+ >
63
+ 整屏幕滑动
64
+ </div>
65
+ <jsv-touch-container
66
+ :style="{
67
+ left: 0,
68
+ top: 40,
69
+ width: (1280 - 60) * 5,
70
+ height: 220,
71
+ backgroundColor: 'rgba(255,0,0,0.5)',
72
+ }"
73
+ :direction="DIRECTION_HORIZONTAL"
74
+ :flingPageWidth="1280 - 60"
75
+ :dragLimitArea="{ x: 0, y: 0, width: 1280 - 60, height: 220 }"
76
+ >
77
+ <div
78
+ v-for="(tabList, tabIndex) in touchContainerH"
79
+ :key="'tab' + tabIndex"
80
+ :style="{
81
+ left: (1280 - 60) * tabIndex,
82
+ top: 0,
83
+ width: 1280 - 60,
84
+ height: 220,
85
+ backgroundColor: randomColor(),
86
+ }"
87
+ >
88
+ <jsv-touch-container
89
+ v-for="(item, itemIndex) in tabList"
90
+ :key="'tab' + tabIndex + '-' + itemIndex"
91
+ :style="{
92
+ left: item.left,
93
+ top: item.top,
94
+ width: item.width,
95
+ height: item.height,
96
+ backgroundColor: item.backgroundColor,
97
+ fontSize: 18,
98
+ }"
99
+ :onClick="_onClick"
100
+ :direction="DIRECTION_DISABLE"
101
+ >{{ item.content }}</jsv-touch-container
102
+ >
103
+ </div>
104
+ </jsv-touch-container>
105
+
106
+ <div
107
+ :style="{
108
+ left: 30,
109
+ top: 280,
110
+ width: 400,
111
+ height: 40,
112
+ fontSize: 18,
113
+ lineHeight: '40px',
114
+ color: '#f0ef29',
115
+ }"
116
+ >
117
+ 左右滑动
118
+ </div>
119
+ <jsv-touch-container
120
+ :style="{
121
+ left: 0,
122
+ top: 320,
123
+ width: (1280 - 60) * 5,
124
+ height: 220,
125
+ backgroundColor: '#1d9797',
126
+ }"
127
+ :direction="DIRECTION_HORIZONTAL"
128
+ :dragLimitArea="{ x: 0, y: 0, width: 1280 - 60, height: 220 }"
129
+ >
130
+ <div
131
+ v-for="(tabList, tabIndex) in touchContainerH"
132
+ :key="'tab' + tabIndex"
133
+ :style="{
134
+ left: (1280 - 60) * tabIndex,
135
+ top: 0,
136
+ width: 1280 - 60,
137
+ height: 220,
138
+ backgroundColor: randomColor(),
139
+ }"
140
+ >
141
+ <jsv-touch-container
142
+ v-for="(item, itemIndex) in tabList"
143
+ :key="'tab' + tabIndex + '-' + itemIndex"
144
+ :style="{
145
+ left: item.left,
146
+ top: item.top,
147
+ width: item.width,
148
+ height: item.height,
149
+ backgroundColor: item.backgroundColor,
150
+ fontSize: 18,
151
+ }"
152
+ :onClick="_onClick"
153
+ :direction="DIRECTION_DISABLE"
154
+ >{{ item.content }}</jsv-touch-container
155
+ >
156
+ </div>
157
+ </jsv-touch-container>
158
+ </jsv-touch-container>
159
+ </div>
160
+ </template>
@@ -0,0 +1,160 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-04-10 21:21:02
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-04-11 09:04:26
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import {
10
+ JsvTouchContainer,
11
+ DIRECTION_VERTICAL,
12
+ DIRECTION_HORIZONTAL,
13
+ DIRECTION_DISABLE,
14
+ } from "jsview";
15
+ import { touchContainerV, measures } from "./data.js";
16
+ function randomColor() {
17
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
18
+ return (
19
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
20
+ );
21
+ }
22
+ export default {
23
+ components: {
24
+ JsvTouchContainer,
25
+ },
26
+ setup() {
27
+ return {
28
+ DIRECTION_VERTICAL,
29
+ DIRECTION_HORIZONTAL,
30
+ DIRECTION_DISABLE,
31
+ touchContainerV,
32
+ measures,
33
+ randomColor,
34
+ };
35
+ },
36
+ methods: {
37
+ _onClick(msg) {
38
+ console.log(`_onClick:${JSON.stringify(msg)}`);
39
+ return true;
40
+ },
41
+ },
42
+ };
43
+ </script>
44
+
45
+ <template>
46
+ <div :style="{ width: 1280, height: 720, overflow: 'hidden' }">
47
+ <jsv-touch-container
48
+ :style="{ width: 1280, height: 720 * 2, backgroundColor: '#7b7a1c' }"
49
+ :direction="DIRECTION_HORIZONTAL"
50
+ :dragLimitArea="{ x: 0, y: 0, width: 1280, height: 720 }"
51
+ >
52
+ <div
53
+ :style="{
54
+ left: 30,
55
+ top: 0,
56
+ width: 400,
57
+ height: 40,
58
+ fontSize: 25,
59
+ lineHeight: '40px',
60
+ color: '#f0ef29',
61
+ }"
62
+ >
63
+ 整屏幕滑动
64
+ </div>
65
+ <jsv-touch-container
66
+ :style="{
67
+ left: 30,
68
+ top: 50,
69
+ width: 400,
70
+ height: 500 * 5,
71
+ backgroundColor: '#810000',
72
+ }"
73
+ :direction="DIRECTION_VERTICAL"
74
+ :flingPageWidth="500"
75
+ :dragLimitArea="{ x: 0, y: 0, width: 400, height: 500 }"
76
+ >
77
+ <div
78
+ v-for="(tabList, tabIndex) in touchContainerV"
79
+ :key="'tab' + tabIndex"
80
+ :style="{
81
+ left: 0,
82
+ top: 500 * tabIndex,
83
+ width: 400,
84
+ height: 500,
85
+ backgroundColor: randomColor(),
86
+ }"
87
+ >
88
+ <jsv-touch-container
89
+ v-for="(item, itemIndex) in tabList"
90
+ :key="'tab' + tabIndex + '-' + itemIndex"
91
+ :style="{
92
+ left: item.left,
93
+ top: item.top,
94
+ width: item.width,
95
+ height: item.height,
96
+ backgroundColor: item.backgroundColor,
97
+ fontSize: 18,
98
+ }"
99
+ :onClick="_onClick"
100
+ :direction="DIRECTION_DISABLE"
101
+ >{{ item.content }}</jsv-touch-container
102
+ >
103
+ </div>
104
+ </jsv-touch-container>
105
+
106
+ <div
107
+ :style="{
108
+ left: 530,
109
+ top: 0,
110
+ width: 400,
111
+ height: 40,
112
+ fontSize: 25,
113
+ lineHeight: '40px',
114
+ color: '#f0ef29',
115
+ }"
116
+ >
117
+ 上下滑动
118
+ </div>
119
+ <jsv-touch-container
120
+ :style="{
121
+ left: 530,
122
+ top: 50,
123
+ width: 400,
124
+ height: 500 * 5,
125
+ backgroundColor: '#810000',
126
+ }"
127
+ :direction="DIRECTION_VERTICAL"
128
+ :dragLimitArea="{ x: 0, y: 0, width: 400, height: 500 }"
129
+ >
130
+ <div
131
+ v-for="(tabList, tabIndex) in touchContainerV"
132
+ :key="'tab' + tabIndex"
133
+ :style="{
134
+ left: 0,
135
+ top: 500 * tabIndex,
136
+ width: 400,
137
+ height: 500,
138
+ backgroundColor: randomColor(),
139
+ }"
140
+ >
141
+ <jsv-touch-container
142
+ v-for="(item, itemIndex) in tabList"
143
+ :key="'tab' + tabIndex + '-' + itemIndex"
144
+ :style="{
145
+ left: item.left,
146
+ top: item.top,
147
+ width: item.width,
148
+ height: item.height,
149
+ backgroundColor: item.backgroundColor,
150
+ fontSize: 18,
151
+ }"
152
+ :onClick="_onClick"
153
+ :direction="DIRECTION_DISABLE"
154
+ >{{ item.content }}</jsv-touch-container
155
+ >
156
+ </div>
157
+ </jsv-touch-container>
158
+ </jsv-touch-container>
159
+ </div>
160
+ </template>
@@ -0,0 +1,81 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-04-10 21:23:15
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-04-11 10:03:21
6
+ * @Description: file content
7
+ */
8
+ function randomColor() {
9
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
10
+ return (
11
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
12
+ );
13
+ }
14
+
15
+ const metroWidgetH = [];
16
+ for (let i = 0; i < 500; i++) {
17
+ metroWidgetH.push({
18
+ content: i,
19
+ id: i,
20
+ width: 100,
21
+ height: 200,
22
+ color: randomColor(),
23
+ });
24
+ }
25
+
26
+ const metroWidgetV = [];
27
+ for (let i = 0; i < 500; i++) {
28
+ metroWidgetV.push({
29
+ content: i,
30
+ id: i,
31
+ width: 200,
32
+ height: 100,
33
+ color: randomColor(),
34
+ });
35
+ }
36
+
37
+ const touchContainerH = [];
38
+ for (let i = 0; i < 5; i++) {
39
+ const tabData = [];
40
+ for (let i = 0; i < 20; i++) {
41
+ tabData.push({
42
+ content: i,
43
+ id: i,
44
+ left: (122 / 2) * i,
45
+ top: 10,
46
+ width: 122 / 2 - 10,
47
+ height: 200,
48
+ backgroundColor: randomColor(),
49
+ });
50
+ }
51
+ touchContainerH.push(tabData);
52
+ }
53
+
54
+ const touchContainerV = [];
55
+ for (let i = 0; i < 5; i++) {
56
+ const tabData = [];
57
+ for (let i = 0; i < 20; i++) {
58
+ tabData.push({
59
+ content: i,
60
+ id: i,
61
+ left: 10,
62
+ top: 50 * i,
63
+ width: 300,
64
+ height: 40,
65
+ backgroundColor: randomColor(),
66
+ });
67
+ }
68
+ touchContainerV.push(tabData);
69
+ }
70
+
71
+ function measures(item) {
72
+ return item;
73
+ }
74
+
75
+ export {
76
+ metroWidgetH,
77
+ metroWidgetV,
78
+ touchContainerH,
79
+ touchContainerV,
80
+ measures,
81
+ };
@@ -0,0 +1,29 @@
1
+ <script setup>
2
+ import DemoApp from "../DemoHomepage/App.vue";
3
+ import ActivityApp from "../MetroWidgetDemos/PerformanceTest/App.vue"; // TODO
4
+ import { jJsvRuntimeBridge } from "jsview";
5
+ import { ref, shallowRef, onMounted } from "vue";
6
+
7
+ const getShowMode = () => {
8
+ let showMode = 0;
9
+ // showMode信息可被URL中的?后缀信息替换
10
+ if (window.location.search.indexOf("showMode=0") >= 0) {
11
+ showMode = 0;
12
+ } else if (window.location.search.indexOf("showMode=1") >= 0) {
13
+ showMode = 1;
14
+ }
15
+
16
+ return showMode;
17
+ };
18
+
19
+ const showMode = ref(getShowMode());
20
+
21
+ onMounted(() => {
22
+ jJsvRuntimeBridge.notifyPageLoaded();
23
+ });
24
+ </script>
25
+
26
+ <template>
27
+ <DemoApp v-if="showMode === 0" />
28
+ <ActivityApp v-else-if="showMode === 1" />
29
+ </template>
@@ -0,0 +1,121 @@
1
+ <script setup>
2
+ import { provide, reactive, ref, shallowRef, watch } from "vue";
3
+ import Controllor from "./components/Controllor.vue";
4
+ import VideoFrame from "./components/VideoFrame.vue";
5
+
6
+ const Caption = {
7
+ offscreenVideo:
8
+ "名称:OffscreenVideo(自动播放)\n" +
9
+ "功能描述:\n" +
10
+ "1.离屏视频播放、支持前进/后退控制\n" +
11
+ "2.支持圆角设置\n" +
12
+ "3.支持平移、缩放、旋转等动画\n" +
13
+ "4.支持ObjectFit调整\n",
14
+ normalVideo:
15
+ "名称:Video\n" +
16
+ "功能描述:\n" +
17
+ "1.视频播放、支持前进/后退控制\n" +
18
+ "2.支持ObjectFit调整\n",
19
+ };
20
+
21
+ let caption = shallowRef(null);
22
+ let useTexture = shallowRef(null);
23
+ let videoTime = reactive({
24
+ currentTime: 0,
25
+ duration: 0,
26
+ });
27
+ let objectFitTitle = shallowRef(null);
28
+ let playStatus = ref("");
29
+ provide("useTexture", useTexture);
30
+ provide("objectFit", shallowRef(null));
31
+ provide("videoRect", ref({}));
32
+ provide("playVideo", shallowRef(null));
33
+ provide("seekVideo", shallowRef(null));
34
+ provide("enableAnimation", shallowRef(null));
35
+ provide("videoTime", videoTime);
36
+ provide("objectFitTitle", objectFitTitle);
37
+ provide("playStatus", playStatus);
38
+ watch(useTexture, () => {
39
+ caption.value = useTexture.value ? Caption.offscreenVideo : Caption.normalVideo;
40
+ });
41
+ </script>
42
+
43
+ <template>
44
+ <div
45
+ :style="{
46
+ top: 0,
47
+ left: 0,
48
+ width: 1280,
49
+ height: 720,
50
+ backgroundColor: 'rgb(222,211,140)',
51
+ }"
52
+ >
53
+ <!-- :key="useTexture" => 当useTexture属性变化时,重建VideoFrame -->
54
+ <VideoFrame :key="useTexture" />
55
+
56
+ <!-- :key="useTexture" => JsView bug,当useTexture属性变化时,为了保证显示在VideoFrame前面 -->
57
+ <div class="caption" :key="useTexture">
58
+ {{ caption }}
59
+ </div>
60
+ <div>
61
+ <div class="text status">
62
+ {{ "播放状态: " + playStatus }}
63
+ </div>
64
+ <div class="text objectFit">
65
+ {{ objectFitTitle }}
66
+ </div>
67
+ <div class="text current">
68
+ {{ Math.ceil(videoTime.currentTime) }}
69
+ </div>
70
+ <div class="text duration">
71
+ {{ "/" + Math.ceil(videoTime.duration) }}
72
+ </div>
73
+ </div>
74
+ <Controllor class="controllor" />
75
+ </div>
76
+ </template>
77
+
78
+ <style scoped>
79
+ .caption {
80
+ text-align: left;
81
+ font-size: 24px;
82
+ line-height: 30px;
83
+ color: #ffffff;
84
+ left: 10;
85
+ top: 10;
86
+ width: 400;
87
+ height: 180;
88
+ background-color: rgba(27, 38, 151, 0.8);
89
+ }
90
+
91
+ .text {
92
+ color: #ff0000;
93
+ font-size: 24px;
94
+ top: 550;
95
+ width: 60;
96
+ height: 40;
97
+ }
98
+ .status {
99
+ left: 50;
100
+ width: 300;
101
+ }
102
+ .objectFit {
103
+ left: 800;
104
+ width: 200;
105
+ text-align: center;
106
+ }
107
+
108
+ .current {
109
+ left: 1060;
110
+ text-align: right;
111
+ }
112
+ .duration {
113
+ left: 1120;
114
+ text-align: left;
115
+ }
116
+
117
+ .controllor {
118
+ left: 40;
119
+ top: 600;
120
+ }
121
+ </style>