@shijiu/jsview-vue-samples 2.2.35 → 2.2.201

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/BakeViewDemo/AnimatePic.vue +93 -0
  2. package/BakeViewDemo/App.vue +109 -0
  3. package/ClickDivDemo/App.vue +150 -0
  4. package/CoupletsTest/widget/Banger/Maroon.vue +4 -6
  5. package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -42
  6. package/CustomShader/App.vue +157 -0
  7. package/CustomShader/gaussianBlur.glsl +27 -0
  8. package/CustomShader/pageFlip.glsl +40 -0
  9. package/CustomShader/sdf.glsl +22 -0
  10. package/CustomShader/test.glsl +8 -0
  11. package/CustomShader/vortex.glsl +38 -0
  12. package/DemoHomepage/App.vue +36 -27
  13. package/DemoHomepage/components/Dialog.vue +37 -11
  14. package/DemoHomepage/components/TabFrame.vue +8 -1
  15. package/DemoHomepage/router.js +71 -26
  16. package/DemoHomepage/views/Homepage.vue +30 -13
  17. package/DriftScopeTest/App.vue +128 -0
  18. package/FocusMoveStyle/App.vue +21 -4
  19. package/FocusMoveStyle/FoldableItem.vue +39 -12
  20. package/FreeMove/App.vue +62 -64
  21. package/FreeMoveChildAttract/App.vue +105 -0
  22. package/FreeMoveLink/App.vue +55 -0
  23. package/FreeMoveResize/App.vue +102 -0
  24. package/ImpactStop/App.vue +45 -45
  25. package/LongImage/App.vue +1 -2
  26. package/LongText/App.vue +3 -5
  27. package/LongText/LongTextScroll.vue +83 -38
  28. package/LongText/Scroll.vue +28 -9
  29. package/LongTextLatex/App.vue +93 -0
  30. package/LongTextLatex/Button.vue +50 -0
  31. package/LongTextLatex/ButtonItem.vue +44 -0
  32. package/LongTextLatex/LongTextScroll.vue +189 -0
  33. package/LongTextLatex/Scroll.vue +14 -0
  34. package/MetroWidgetDemos/MassiveItems/App.vue +87 -0
  35. package/MetroWidgetDemos/MassiveItems/ContentItem.vue +388 -0
  36. package/MetroWidgetDemos/MassiveItems/Item.vue +203 -0
  37. package/MetroWidgetDemos/MassiveItems/WidgetItem.vue +101 -0
  38. package/MetroWidgetDemos/MassiveItems/data.js +17 -0
  39. package/MetroWidgetDemos/PingPong/AppPage.vue +19 -9
  40. package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
  41. package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
  42. package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
  43. package/MetroWidgetDemos/routeList.js +6 -0
  44. package/SceneTransition/JsvSceneTransition.vue +30 -42
  45. package/ScrollBoxTest/App.vue +109 -0
  46. package/ScrollBoxTest/ClipBar.vue +153 -0
  47. package/ScrollBoxTest/DrawCircle.ts +25 -0
  48. package/ScrollBoxTest/NinePatchBar.vue +187 -0
  49. package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
  50. package/ScrollBoxTest/SizeDivBar.vue +138 -0
  51. package/TestNativeSharedView/App.vue +166 -73
  52. package/TextureAnimation/App2.vue +17 -6
  53. package/TombSweepingDayTest/Raining/Rain.vue +8 -8
  54. package/TombSweepingDayTest/Raining/RainScene.vue +36 -24
  55. package/package.json +1 -1
  56. package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <jsv-focus-block autoFocus :onKeyDown="procKeyDown">
3
+ <div class="bgStyle">
4
+ <jsv-free-move-div
5
+ ref="mActRef1"
6
+ :style="{
7
+ top: 100,
8
+ left: 200,
9
+ width: 500,
10
+ height: 350,
11
+ backgroundColor: '#00F00F',
12
+ overflow: 'hidden',
13
+ }"
14
+ :sizeMode="true"
15
+ >
16
+ <div
17
+ :style="{
18
+ width: 400,
19
+ height: 400,
20
+ fontSize: 50,
21
+ backgroundColor: '#FF0000',
22
+ }"
23
+ >
24
+ {{ "测试文字" }}
25
+ </div>
26
+ </jsv-free-move-div>
27
+ </div>
28
+ </jsv-focus-block>
29
+ </template>
30
+
31
+ <script setup>
32
+ import { JsvFreeMoveDiv, FreeMoveDef } from "jsview";
33
+ import { shallowRef, onMounted, watch } from "vue";
34
+ import { useRouter } from "vue-router";
35
+
36
+ const router = useRouter();
37
+ const procKeyDown = (ev) => {
38
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
39
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
40
+ router.go(-1); // 有router时,是从DemoHomepage进入,回退
41
+ return true;
42
+ }
43
+
44
+ return false;
45
+ };
46
+
47
+ const mActRef1 = shallowRef(null);
48
+ let mActControl1 = null;
49
+
50
+ onMounted(() => {
51
+ mActControl1 = mActRef1.value.control;
52
+ window.DebugControl = mActControl1;
53
+ });
54
+
55
+ // 预设动画控制
56
+ function MoveToRightBottom() {
57
+ mActControl1.run([
58
+ mActControl1.state().clearAllConditions(),
59
+ mActControl1.action().moveTo(600, 500, undefined, 3),
60
+ ]);
61
+ }
62
+
63
+ function MoveToLeftTop() {
64
+ mActControl1.run([
65
+ mActControl1.state().clearAllConditions(),
66
+ mActControl1.action().moveTo(100, 200, 3, undefined),
67
+ ]);
68
+ }
69
+
70
+ // 暴露给devtool去使用
71
+ window.DebugFreeMove = {
72
+ MoveToRightBottom,
73
+ MoveToLeftTop,
74
+ };
75
+ </script>
76
+
77
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
78
+ <style scoped>
79
+ .bgStyle {
80
+ width: 1280;
81
+ height: 720;
82
+ background-color: #007788;
83
+ }
84
+ .box {
85
+ width: 150;
86
+ height: 150;
87
+ font-size: 30;
88
+ color: #000000;
89
+ background-color: #3fb524;
90
+ }
91
+ .tip {
92
+ width: 300;
93
+ height: 30;
94
+ line-height: 28;
95
+ font-size: 28;
96
+ left: 980;
97
+ top: 680;
98
+ text-align: center;
99
+ font-weight: bold;
100
+ color: #ffffff;
101
+ }
102
+ </style>
@@ -196,16 +196,16 @@ const procKeyDown = (ev) => {
196
196
 
197
197
  let interactNexus = FreeMoveFunc.newNexus();
198
198
 
199
- actorControl.run([
200
- actorControl.state().clearAllConditions(),
201
- actorControl
199
+ actorControl.run((cmds) => [
200
+ cmds.state().clearAllConditions(),
201
+ cmds
202
202
  .condition()
203
203
  .onNextTick(1)
204
204
  .then([
205
205
  () => {
206
206
  bodyState.value = 1;
207
207
  },
208
- actorControl
208
+ cmds
209
209
  .condition()
210
210
  .onHitBlock(1)
211
211
  .then([
@@ -213,8 +213,8 @@ const procKeyDown = (ev) => {
213
213
  console.log("LudlDebug on hit 1");
214
214
  bodyState.value = 0;
215
215
  },
216
- actorControl.state().revertWithHitBlock(),
217
- actorControl.action().stopMoving(),
216
+ cmds.state().revertWithHitBlock(),
217
+ cmds.action().stopMoving(),
218
218
  (a) => {
219
219
  jumping = false;
220
220
 
@@ -239,11 +239,11 @@ const procKeyDown = (ev) => {
239
239
  ]);
240
240
 
241
241
  if (direction.value) {
242
- actorControl.run([
243
- actorControl
242
+ actorControl.run((cmds) => [
243
+ cmds
244
244
  .action(0, 0, interactNexus)
245
245
  .setSpdAndAccel(7.9, -24, undefined, 1, null, () => {}),
246
- actorControl
246
+ cmds
247
247
  .condition()
248
248
  .onNexusEvent(interactNexus, actEvents.SpeedRevertY)
249
249
  .then([
@@ -253,11 +253,11 @@ const procKeyDown = (ev) => {
253
253
  ]),
254
254
  ]);
255
255
  } else {
256
- actorControl.run([
257
- actorControl
256
+ actorControl.run((cmds) => [
257
+ cmds
258
258
  .action(0, 0, interactNexus)
259
259
  .setSpdAndAccel(-7.9, -24, undefined, 1, null, () => {}),
260
- actorControl
260
+ cmds
261
261
  .condition()
262
262
  .onNexusEvent(interactNexus, actEvents.SpeedRevertY)
263
263
  .then([
@@ -271,61 +271,61 @@ const procKeyDown = (ev) => {
271
271
  break;
272
272
  case 37:
273
273
  if (board == "left") {
274
- actorControl.run([actorControl.action().setSpeed(-5, 0)]);
275
- actorControl.run([
276
- actorControl.state().clearAllConditions(),
277
- actorControl
274
+ actorControl.run((cmds) => [cmds.action().setSpeed(-5, 0)]);
275
+ actorControl.run((cmds) => [
276
+ cmds.state().clearAllConditions(),
277
+ cmds
278
278
  .condition()
279
279
  .reachPosition(0, undefined)
280
- .then([actorControl.action().stopMoving()]),
280
+ .then([cmds.action().stopMoving()]),
281
281
  ]);
282
282
  } else if (board == "right") {
283
- actorControl.run([actorControl.action().setSpeed(-5, 0)]);
284
- actorControl.run([
285
- actorControl.state().clearAllConditions(),
286
- actorControl
283
+ actorControl.run((cmds) => [cmds.action().setSpeed(-5, 0)]);
284
+ actorControl.run((cmds) => [
285
+ cmds.state().clearAllConditions(),
286
+ cmds
287
287
  .condition()
288
288
  .reachPosition(840 - 40, undefined)
289
- .then([actorControl.action().stopMoving()]),
289
+ .then([cmds.action().stopMoving()]),
290
290
  ]);
291
291
  } else if (board == "middle") {
292
- actorControl.run([actorControl.action().setSpeed(-5, 0)]);
293
- actorControl.run([
294
- actorControl.state().clearAllConditions(),
295
- actorControl
292
+ actorControl.run((cmds) => [cmds.action().setSpeed(-5, 0)]);
293
+ actorControl.run((cmds) => [
294
+ cmds.state().clearAllConditions(),
295
+ cmds
296
296
  .condition()
297
297
  .reachPosition(540 - 40, undefined)
298
- .then([actorControl.action().stopMoving()]),
298
+ .then([cmds.action().stopMoving()]),
299
299
  ]);
300
300
  }
301
301
  break;
302
302
  case 39:
303
303
  if (board == "left") {
304
- actorControl.run([actorControl.action().setSpeed(5, 0)]);
305
- actorControl.run([
306
- actorControl.state().clearAllConditions(),
307
- actorControl
304
+ actorControl.run((cmds) => [cmds.action().setSpeed(5, 0)]);
305
+ actorControl.run((cmds) => [
306
+ cmds.state().clearAllConditions(),
307
+ cmds
308
308
  .condition()
309
309
  .reachPosition(410 - 40, undefined)
310
- .then([actorControl.action().stopMoving()]),
310
+ .then([cmds.action().stopMoving()]),
311
311
  ]);
312
312
  } else if (board == "right") {
313
- actorControl.run([actorControl.action().setSpeed(5, 0)]);
314
- actorControl.run([
315
- actorControl.state().clearAllConditions(),
316
- actorControl
313
+ actorControl.run((cmds) => [cmds.action().setSpeed(5, 0)]);
314
+ actorControl.run((cmds) => [
315
+ cmds.state().clearAllConditions(),
316
+ cmds
317
317
  .condition()
318
318
  .reachPosition(1240 - 30 - 40, undefined)
319
- .then([actorControl.action().stopMoving()]),
319
+ .then([cmds.action().stopMoving()]),
320
320
  ]);
321
321
  } else if (board == "middle") {
322
- actorControl.run([actorControl.action().setSpeed(5, 0)]);
323
- actorControl.run([
324
- actorControl.state().clearAllConditions(),
325
- actorControl
322
+ actorControl.run((cmds) => [cmds.action().setSpeed(5, 0)]);
323
+ actorControl.run((cmds) => [
324
+ cmds.state().clearAllConditions(),
325
+ cmds
326
326
  .condition()
327
327
  .reachPosition(740 - 40 - 30, undefined)
328
- .then([actorControl.action().stopMoving()]),
328
+ .then([cmds.action().stopMoving()]),
329
329
  ]);
330
330
  }
331
331
  break;
@@ -338,10 +338,10 @@ const procKeyUp = (ev) => {
338
338
  }
339
339
  switch (ev.keyCode) {
340
340
  case 37:
341
- actorControl.run([actorControl.action().stopMoving()]);
341
+ actorControl.run((cmds) => [cmds.action().stopMoving()]);
342
342
  break;
343
343
  case 39:
344
- actorControl.run([actorControl.action().stopMoving()]);
344
+ actorControl.run((cmds) => [cmds.action().stopMoving()]);
345
345
  break;
346
346
 
347
347
  default:
@@ -357,7 +357,7 @@ const onActionObj = {
357
357
  const reset = () => {
358
358
  board = "left";
359
359
  direction.value = 1;
360
- actorControl.run([actorControl.action().teleportTo(0, 0)]);
360
+ actorControl.run((cmds) => [cmds.action().teleportTo(0, 0)]);
361
361
  };
362
362
  onMounted(() => {
363
363
  actorControl = actorRef.value.control;
package/LongImage/App.vue CHANGED
@@ -32,7 +32,6 @@ const onKeyDown = (ev) => {
32
32
  };
33
33
  </script>
34
34
 
35
-
36
35
  <template>
37
36
  <jsv-focus-block
38
37
  autoFocus
@@ -53,7 +52,7 @@ const onKeyDown = (ev) => {
53
52
  backgroundColor: 'rgba(27,38,151,0.8)',
54
53
  }"
55
54
  >
56
- 可加载长或宽超过2048px的图片
55
+ 可加载长或宽超过maxBuffer(1080p:4096px)的图片
57
56
  </div>
58
57
  <div :style="{ left: 100, top: 100 }">
59
58
  <LongImageScroll
package/LongText/App.vue CHANGED
@@ -62,20 +62,20 @@ onMounted(() => {
62
62
  backgroundColor: 'rgba(27,38,151,0.8)',
63
63
  }"
64
64
  >
65
- 可展示篇幅超过一屏的文字
65
+ 可展示篇幅超过一屏的文字(支持触控拖拽)
66
66
  </div>
67
67
  <div :style="{ left: 140, top: 100 }">
68
68
  <LongTextScroll
69
69
  :style="{ width: 1000, height: 500, backgroundColor: '#EEEEEE' }"
70
70
  :textStyle="{ color: '#000000', fontSize: 20 }"
71
71
  :scrollBlockStyle="{
72
- width: 10,
72
+ width: 15,
73
73
  height: 30,
74
74
  backgroundColor: '#555555',
75
75
  }"
76
76
  :scrollStyle="{
77
77
  left: 1005,
78
- width: 10,
78
+ width: 15,
79
79
  height: 500,
80
80
  backgroundColor: '#DDDDDD',
81
81
  }"
@@ -89,5 +89,3 @@ onMounted(() => {
89
89
  </div>
90
90
  </jsv-focus-block>
91
91
  </template>
92
-
93
-
@@ -1,7 +1,13 @@
1
1
  <script setup>
2
2
  import Scroll from "./Scroll.vue";
3
- import { ref, onMounted } from "vue";
4
- import { useFocusHub, JsvFlexDiv } from "jsview";
3
+ import { ref, onMounted, shallowRef } from "vue";
4
+ import {
5
+ useFocusHub,
6
+ JsvFlexDiv,
7
+ VERTICAL,
8
+ JsvScrollBox,
9
+ ScrollBoxStyle,
10
+ } from "jsview";
5
11
 
6
12
  const props = defineProps({
7
13
  step: Number,
@@ -16,11 +22,14 @@ const focusHub = useFocusHub();
16
22
  const rootRef = ref(null);
17
23
  const element = ref(null);
18
24
  const scrollY = ref(0);
19
- const textY = ref(0);
20
25
 
26
+ let textY = 0;
27
+ let rScrollHeight = shallowRef(0);
28
+ let rJsvScrollBox = shallowRef(null);
21
29
  let textTotalHeight = 0;
22
30
  const onTextSizeReady = (width, height) => {
23
31
  textTotalHeight = height;
32
+ rScrollHeight.value = height;
24
33
  console.log(`textSize ready width=${width} height=${height}`);
25
34
  };
26
35
 
@@ -30,32 +39,25 @@ const onAction = {
30
39
  // let keyUsed = true;
31
40
  if (valid) {
32
41
  // 测试用比对代码,正式场景不需要
33
- if (textTotalHeight != element.value.clientHeight) {
34
- console.error("Error: height miss match");
35
- }
42
+ // if (textTotalHeight != element.value.clientHeight) {
43
+ // console.error("Error: height miss match");
44
+ // }
36
45
 
37
46
  let text_y;
38
47
  switch (ev.keyCode) {
39
48
  case 38:
40
- if (textY.value !== 0) {
41
- text_y =
42
- textY.value + props.step >= 0 ? 0 : textY.value + props.step;
43
- (textY.value = text_y),
44
- (scrollY.value =
45
- (-text_y / (textTotalHeight - props.style.height)) *
46
- (props.scrollStyle.height - props.scrollBlockStyle.height));
49
+ if (textY !== 0) {
50
+ text_y = textY + props.step >= 0 ? 0 : textY + props.step;
51
+ slideToYByKey(text_y);
47
52
  }
48
53
  break;
49
54
  case 40:
50
- if (textY.value !== props.style.height - textTotalHeight) {
55
+ if (textY !== props.style.height - textTotalHeight) {
51
56
  text_y =
52
- textY.value - props.step <= props.style.height - textTotalHeight
57
+ textY - props.step <= props.style.height - textTotalHeight
53
58
  ? props.style.height - textTotalHeight
54
- : textY.value - props.step;
55
- (textY.value = text_y),
56
- (scrollY.value =
57
- (-text_y / (textTotalHeight - props.style.height)) *
58
- (props.scrollStyle.height - props.scrollBlockStyle.height));
59
+ : textY - props.step;
60
+ slideToYByKey(text_y);
59
61
  } else {
60
62
  focusHub.setFocus("button");
61
63
  }
@@ -71,25 +73,70 @@ const onAction = {
71
73
  },
72
74
  };
73
75
 
76
+ function slideToYByKey(newY) {
77
+ // 使用新的Y来调整ScrollBox的显示位置
78
+ rJsvScrollBox.value.updatePercent(
79
+ -newY / (textTotalHeight - props.style.height)
80
+ );
81
+
82
+ recordTextY(newY);
83
+
84
+ // 不再直接更新右边进度条的进度
85
+ // 将由 JsvScrollBox 的syncWith机制来同步
86
+ // 注意: 目前这个机制在PC上没有模拟,
87
+ // 如果PC上也需要看到同步效果,则可通过 window.JsView 是否存在来识别非盒子情况,此时主动改变bar的top
88
+ }
89
+
90
+ function recordTextY(newY) {
91
+ // 记录text Y,为为下次按键的基准坐标
92
+ textY = newY;
93
+ }
94
+
74
95
  onMounted(() => {
75
96
  rootRef.value.requestFocus();
97
+
98
+ // 检测滚动触控触发的移动,
99
+ // 当 updatePercent 调用后如果移动距离大于阈值也会回调
100
+ rJsvScrollBox.value.setSensor((percent, x, y) => {
101
+ let newY = Math.floor(y);
102
+ console.log(
103
+ `onProgress dragged percent=${percent} x=${Math.floor(x)} y=${newY}`
104
+ );
105
+ recordTextY(newY);
106
+ }, 15 /* 每动15px才接收一次通知,减少js被调用的频率,从而减小对性能的影响 */);
76
107
  });
77
108
  </script>
78
109
 
79
110
  <template>
80
111
  <jsv-focus-block ref="rootRef" name="longTextScroll" :onAction="onAction">
81
112
  <div :style="{ overflow: 'hidden', ...style }">
82
- <jsv-flex-div
83
- :style="{ top: textY, width: style.width }"
84
- :onSized="onTextSizeReady"
113
+ <jsv-scroll-box
114
+ ref="rJsvScrollBox"
115
+ linkName="ScrollBoxTextArea"
116
+ syncWith="ScrollBarTextArea"
117
+ :style="{
118
+ width: style.width,
119
+ height: style.height,
120
+ }"
121
+ :direction="VERTICAL"
122
+ :mode="ScrollBoxStyle.DrawerMode"
123
+ :enableFling="true"
124
+ :sliderSize="{
125
+ height: rScrollHeight == 0 ? style.height : rScrollHeight,
126
+ }"
85
127
  >
86
- <div
87
- ref="element"
88
- data-jsv-perf-loadtex="auto"
89
- :style="{ width: style.width, ...textStyle }"
90
- >
91
- {{
92
- "疾风引擎JsView用户服务协议及隐私权保护政策\n\
128
+ <template #SliderBox>
129
+ <jsv-flex-div
130
+ :style="{ width: style.width }"
131
+ :onSized="onTextSizeReady"
132
+ >
133
+ <div
134
+ ref="element"
135
+ data-jsv-perf-loadtex="auto"
136
+ :style="{ width: style.width, ...textStyle }"
137
+ >
138
+ {{
139
+ "疾风引擎JsView用户服务协议及隐私权保护政策\n\
93
140
  \n\
94
141
  \n\
95
142
  特别提示:\n\
@@ -186,14 +233,12 @@ onMounted(() => {
186
233
  本协议条款的效力和解释均适用中华人民共和国的法律,如有条款与中华人民共和国法律相抵触,则该部分条款应按法律规定重新解释,部分条款的无效或重新解释不影响其他条款的法律效力。\n\
187
234
  本协议以及疾风引擎JsView制度将统一构成您与运营方之间的完整协议,两者约定不一致的,以文本制定时间较晚者为准。\n\
188
235
  本协议签订地为中华人民共和国上海市,若您在使用疾风引擎JsView过程中产生任何纠纷或争议,您同意将该纠纷或者争议提交本协议签订地人民法院管辖。本协议条款无论何种原因部分无效或不可执行,其他条款仍应继续有效,对双方具有约束力。"
189
- }}
190
- </div>
191
- </jsv-flex-div>
236
+ }}
237
+ </div>
238
+ </jsv-flex-div>
239
+ </template>
240
+ </jsv-scroll-box>
192
241
  </div>
193
- <Scroll
194
- :top="scrollY"
195
- :scrollStyle="scrollStyle"
196
- :scrollBlockStyle="scrollBlockStyle"
197
- />
242
+ <Scroll :scrollStyle="scrollStyle" :scrollBlockStyle="scrollBlockStyle" />
198
243
  </jsv-focus-block>
199
244
  </template>
@@ -1,14 +1,33 @@
1
- <script setup>
2
- defineProps({
1
+ <script setup lang="ts">
2
+ import { VERTICAL, JsvScrollBox, SeamlessSlide, ScrollBoxStyle } from "jsview";
3
+
4
+ let rProps = defineProps({
3
5
  scrollStyle: Object,
4
- top: Number,
5
6
  scrollBlockStyle: Object,
6
7
  });
8
+
9
+ let { left: cScrollLeft, ...cScrollSubStyle } = rProps.scrollStyle as any;
7
10
  </script>
8
11
  <template>
9
- <div :style="{ ...scrollStyle }">
10
- <div :style="{ top: top }">
11
- <div :style="{ ...scrollBlockStyle }"></div>
12
- </div>
13
- </div>
14
- </template>
12
+ <jsv-scroll-box
13
+ linkName="ScrollBarTextArea"
14
+ syncWith="ScrollBoxTextArea"
15
+ :style="{
16
+ left: cScrollLeft,
17
+ width: cScrollSubStyle.width,
18
+ height: cScrollSubStyle.height,
19
+ }"
20
+ :direction="VERTICAL"
21
+ :mode="ScrollBoxStyle.PinMode"
22
+ :sliderSize="{
23
+ height: (rProps.scrollBlockStyle as any).height,
24
+ }"
25
+ >
26
+ <template #FixedBox>
27
+ <div :style="{ ...cScrollSubStyle }" />
28
+ </template>
29
+ <template #SliderBox>
30
+ <div :style="{ ...rProps.scrollBlockStyle }" />
31
+ </template>
32
+ </jsv-scroll-box>
33
+ </template>
@@ -0,0 +1,93 @@
1
+ <!--
2
+ * 【界面概述】
3
+ * 协议书的示例
4
+ *
5
+ * 【技巧说明】
6
+ * Q: 如何长文字div的高度自适应?
7
+ * A: 描画长文字的div的高度不设置即可
8
+ * 并通过element.clientHeight获取渲染后的自动高度,以决定滚动轴的总高度
9
+ *
10
+ * Q: 长段文字如何换行?
11
+ * A: 若文字内容中需要折行,则需要把要显示内容放入字符串中,并加入'\n'来达到换行效果,例如:
12
+ * <div>{"第一行
13
+ * 第二行"}</div>
14
+ * =======需要改成=======
15
+ * <div>{"第一行\n\
16
+ * 第二行"}</div>
17
+ *
18
+ * Q: 文字首行缩进如何做?
19
+ * A: 目前系统只支持通过空格进行首行缩进,行首加入期望的空格数量即可达到缩进,因为盒子字体库和PC不尽相同,
20
+ * 所以务必在盒子上实际测试缩进效果。
21
+ -->
22
+
23
+ <script setup>
24
+ import LongTextScroll from "./LongTextScroll.vue";
25
+ import Button from "./Button.vue";
26
+ import { jJsvRuntimeBridge } from "jsview";
27
+ import { onMounted, ref } from "vue";
28
+ import { useRouter } from "vue-router";
29
+
30
+ const router = useRouter();
31
+
32
+ const onKeyDown = (ev) => {
33
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
34
+ router.go(-1); // 有router时,是从DemoHomepage进入,回退
35
+ }
36
+ return true;
37
+ };
38
+
39
+ onMounted(() => {
40
+ jJsvRuntimeBridge.notifyPageLoaded();
41
+ });
42
+ </script>
43
+
44
+ <template>
45
+ <jsv-focus-block
46
+ autoFocus
47
+ :onAction="{
48
+ onKeyDown: onKeyDown,
49
+ }"
50
+ >
51
+ <div>
52
+ <div
53
+ :style="{
54
+ textAlign: 'center',
55
+ fontSize: 30,
56
+ lineHeight: 50,
57
+ color: '#ffffff',
58
+ left: 140,
59
+ top: 20,
60
+ width: 1000,
61
+ height: 50,
62
+ backgroundColor: 'rgba(27,38,151,0.8)',
63
+ }"
64
+ >
65
+ 可展示篇幅超过一屏的文字
66
+ </div>
67
+ <div :style="{ left: 140, top: 100 }">
68
+ <LongTextScroll
69
+ :style="{ width: 1000, height: 500, backgroundColor: '#EEEEEE' }"
70
+ :textStyle="{ color: '#000000', fontSize: 20 }"
71
+ :scrollBlockStyle="{
72
+ width: 10,
73
+ height: 30,
74
+ backgroundColor: '#555555',
75
+ }"
76
+ :scrollStyle="{
77
+ left: 1005,
78
+ width: 10,
79
+ height: 500,
80
+ backgroundColor: '#DDDDDD',
81
+ }"
82
+ :step="20"
83
+ >
84
+ </LongTextScroll>
85
+ <div :style="{ left: 400, top: 550 }">
86
+ <Button />
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </jsv-focus-block>
91
+ </template>
92
+
93
+
@@ -0,0 +1,50 @@
1
+ <script setup>
2
+ import { HORIZONTAL, MetroWidget, EdgeDirection, useFocusHub } from "jsview";
3
+ import ButtonItem from "./ButtonItem.vue";
4
+
5
+ const focusHub = useFocusHub();
6
+ const data = [
7
+ {
8
+ width: 100,
9
+ height: 50,
10
+ marginRight: 100,
11
+ content: "同意",
12
+ },
13
+ {
14
+ width: 100,
15
+ height: 50,
16
+ content: "取消",
17
+ },
18
+ ];
19
+
20
+ const measures = (item) => {
21
+ return item;
22
+ };
23
+
24
+ const onEdge = (edgeInfo) => {
25
+ if (edgeInfo.direction == EdgeDirection.top) {
26
+ focusHub.setFocus("longTextScroll");
27
+ }
28
+ };
29
+ </script>
30
+
31
+ <template>
32
+ <metro-widget
33
+ name="button"
34
+ :width="500"
35
+ :height="50"
36
+ :data="data"
37
+ :direction="HORIZONTAL"
38
+ :measures="measures"
39
+ :onEdge="onEdge"
40
+ >
41
+ <template #renderItem="{ data, query, onEdge, onAction }">
42
+ <button-item
43
+ :data="data"
44
+ :query="query"
45
+ :onEdge="onEdge"
46
+ :onAction="onAction"
47
+ />
48
+ </template>
49
+ </metro-widget>
50
+ </template>