@shijiu/jsview-vue 0.9.602 → 0.9.684

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 (86) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/bin/jsview-engine-js-browser.min.js +1 -0
  4. package/dom/target_core_revision.js +4 -4
  5. package/package.json +1 -1
  6. package/samples/Basic/components/text/TextOverflow.vue +10 -5
  7. package/samples/Collision/App.vue +452 -0
  8. package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
  9. package/samples/DemoHomepage/router.js +25 -0
  10. package/samples/DemoHomepage/views/Homepage.vue +3 -10
  11. package/samples/ImpactStop/App.vue +435 -0
  12. package/samples/Input/App.vue +8 -17
  13. package/samples/Input/InputPanel.vue +18 -11
  14. package/samples/Marquee/App.vue +176 -40
  15. package/samples/Marquee/longText.js +14 -0
  16. package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
  17. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +1 -1
  18. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
  19. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
  20. package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  21. package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  22. package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
  23. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  24. package/samples/MetroWidgetDemos/Item.vue +20 -2
  25. package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
  26. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
  27. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
  28. package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +2 -10
  29. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
  30. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
  31. package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
  32. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +4 -4
  33. package/samples/MetroWidgetDemos/data.js +2 -1
  34. package/samples/Preload/App.vue +16 -11
  35. package/samples/ScaleDownNeon/App.vue +107 -0
  36. package/samples/TextBox/App.vue +7 -81
  37. package/samples/TextBox/RenderCenter.vue +40 -16
  38. package/samples/TextBox/RenderLeft.vue +48 -19
  39. package/samples/TextBox/RenderOneLine.vue +30 -49
  40. package/samples/TextBox/RenderRight.vue +40 -16
  41. package/samples/TextShadowDemo/App.vue +11 -17
  42. package/samples/TextureAnimation/App2.vue +111 -0
  43. package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
  44. package/samples/TextureAnimation/assets/light.png +0 -0
  45. package/samples/TextureAnimation/assets/light2.png +0 -0
  46. package/samples/TextureAnimation/assets/mask.png +0 -0
  47. package/samples/TextureSize/App.vue +3 -3
  48. package/samples/VisibleSensorDemo/App.vue +92 -25
  49. package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
  50. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +188 -80
  51. package/utils/JsViewEngineWidget/TemplateParser.js +89 -32
  52. package/utils/JsViewEngineWidget/WidgetCommon.js +3 -4
  53. package/utils/JsViewEngineWidget/index.js +3 -2
  54. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
  55. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +25 -3
  56. package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
  57. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  58. package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
  59. package/utils/JsViewVueTools/index.js +2 -1
  60. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
  61. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
  62. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
  63. package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
  64. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
  65. package/utils/JsViewVueWidget/JsvMarquee.vue +178 -205
  66. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
  67. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
  68. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +37 -41
  69. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
  70. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +18 -2
  71. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +22 -2
  72. package/utils/JsViewVueWidget/JsvTextBox.vue +35 -72
  73. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +123 -46
  74. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
  75. package/utils/JsViewVueWidget/JsvTouchContainer.vue +3 -4
  76. package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
  77. package/utils/JsViewVueWidget/index.js +2 -2
  78. package/utils/JsViewVueWidget/utils/index.js +8 -0
  79. package/utils/JsViewVueWidget/utils/text.js +19 -0
  80. package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
  81. package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
  82. package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
  83. package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
  84. package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
  85. package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
  86. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
@@ -2,11 +2,11 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-05-10 15:21:24
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-11 17:00:58
5
+ * @LastEditTime: 2022-11-01 15:24:26
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { ref } from "vue";
9
+ import { ref, inject } from "vue";
10
10
 
11
11
  const props = defineProps({
12
12
  data: Object,
@@ -14,11 +14,28 @@ const props = defineProps({
14
14
  onAction: Object,
15
15
  });
16
16
 
17
+ const divRef = ref(null);
17
18
  const focused = ref(false);
18
19
 
20
+ const focusSize = inject("focusSize");
21
+
19
22
  // 自身的焦点状态自己记录, 通过回调来改变
20
23
  const onFocus = () => {
21
24
  focused.value = true;
25
+ if (focusSize) {
26
+ divRef.value?.getBoundingClientRect().then(
27
+ (data) => {
28
+ console.log("testtest focus size", data)
29
+ focusSize.width = data.width;
30
+ focusSize.height = data.height;
31
+ focusSize.left = data.left;
32
+ focusSize.top = data.top;
33
+ },
34
+ (error) => {
35
+ console.log("testtest abs failed", error);
36
+ }
37
+ );
38
+ }
22
39
  };
23
40
  const onBlur = () => {
24
41
  focused.value = false;
@@ -53,6 +70,7 @@ props.onAction.register("onClick", onClick);
53
70
  }"
54
71
  ></div>
55
72
  <div
73
+ ref="divRef"
56
74
  :style="{
57
75
  width: data.width,
58
76
  height: data.height,
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-12-21 15:36:29
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 16:11:32
5
+ * @LastEditTime: 2022-09-01 17:08:21
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -20,13 +20,13 @@ for (let i = 0; i < 5; i++) {
20
20
  width: 100,
21
21
  height: 50,
22
22
  marginRight: 10,
23
- content: "Tab-" + i,
23
+ content: "Tab_" + i,
24
24
  color: randomColor(),
25
25
  });
26
26
 
27
27
  let data = JSON.parse(JSON.stringify(advanceMetroWidget));
28
28
  data.forEach((item) => {
29
- item.name = "testPage-" + i + "-" + item.name;
29
+ item.name = "testPage_" + i + "-" + item.name;
30
30
  });
31
31
  pageList.push({
32
32
  width: 600,
@@ -2,13 +2,13 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 10:45:38
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 14:43:49
5
+ * @LastEditTime: 2022-09-01 17:04:31
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
9
  import { VERTICAL, MetroWidget } from "jsview";
10
10
  import WidgetItem from "../WidgetItem.vue";
11
- import { reactive } from "vue";
11
+ import { ref, watch, onBeforeUnmount } from "vue";
12
12
 
13
13
  const props = defineProps({
14
14
  data: {
@@ -24,6 +24,8 @@ const props = defineProps({
24
24
  },
25
25
  });
26
26
 
27
+ const widgetRef = ref(null);
28
+
27
29
  const provideData = () => {
28
30
  return props.data.data;
29
31
  };
@@ -34,10 +36,23 @@ const measures = (item) => {
34
36
  doSlide: false,
35
37
  };
36
38
  };
39
+
40
+ const watcher = watch(
41
+ () => props.data,
42
+ (newValue, oldValue) => {
43
+ widgetRef.value?.refreshData();
44
+ }
45
+ );
46
+
47
+ onBeforeUnmount(() => {
48
+ watcher();
49
+ })
50
+
37
51
  </script>
38
52
 
39
53
  <template>
40
54
  <metro-widget
55
+ ref="widgetRef"
41
56
  :name="name"
42
57
  :width="data.width"
43
58
  :height="data.height"
@@ -2,19 +2,12 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 10:45:19
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 15:39:29
5
+ * @LastEditTime: 2022-09-01 16:19:51
6
6
  * @Description: file content
7
7
  -->
8
- <!--
9
- * @Author: ChenChanghua
10
- * @Date: 2021-12-21 17:18:58
11
- * @LastEditors: ChenChanghua
12
- * @LastEditTime: 2021-12-28 10:58:25
13
- * @Description: 标题 tab
14
- -->
15
8
  <script setup>
16
9
  import { HORIZONTAL, MetroWidget } from "jsview";
17
- import Item from "./Item.vue";
10
+ import TabItem from "./TabItem.vue";
18
11
 
19
12
  const props = defineProps({
20
13
  data: {
@@ -62,7 +55,7 @@ const provideData = () => {
62
55
  }"
63
56
  >
64
57
  <template #renderItem="{ data, query, onAction }">
65
- <item :data="data" :query="query" :onAction="onAction"></item>
58
+ <tab-item :data="data" :query="query" :onAction="onAction"></tab-item>
66
59
  </template>
67
60
  </metro-widget>
68
61
  </jsv-focus-block>
@@ -2,14 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 14:52:53
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 16:08:56
6
- * @Description: file content
7
- -->
8
- <!--
9
- * @Author: ChenChanghua
10
- * @Date: 2022-05-10 15:21:24
11
- * @LastEditors: ChenChanghua
12
- * @LastEditTime: 2022-07-11 17:00:58
5
+ * @LastEditTime: 2022-09-01 17:10:14
13
6
  * @Description: file content
14
7
  -->
15
8
  <script setup>
@@ -33,13 +26,12 @@ const onFocus = () => {
33
26
  active.value = false;
34
27
  };
35
28
  const onBlur = () => {
36
- console.log("cchtest item onblur");
37
29
  focused.value = false;
38
30
  active.value =
39
31
  props.query.getCurrentFocusId().id === props.query.id ? true : false;
40
32
  };
41
33
  const onClick = () => {
42
- console.log("item onclick ", props.data);
34
+ console.log("tab item onclick ", props.data);
43
35
  };
44
36
 
45
37
  // 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
@@ -2,13 +2,13 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-12 10:30:33
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-13 10:50:43
5
+ * @LastEditTime: 2022-09-01 17:05:07
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
9
  import AppPage from "./AppPage.vue";
10
10
  import { getKeyFramesGroup } from "jsview";
11
- import { reactive } from "vue";
11
+ import { reactive, ref } from "vue";
12
12
 
13
13
  export default {
14
14
  components: {
@@ -10,7 +10,7 @@ import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
10
10
  import { useFocusHub } from "jsview";
11
11
  import { simpleDataAbs } from "../data";
12
12
  import Item from "../Item.vue";
13
- const foucsHub = useFocusHub();
13
+ const focusHub = useFocusHub();
14
14
 
15
15
  const wholePageSlide = new WholePageSlide();
16
16
 
@@ -29,7 +29,7 @@ const measuresAbs = (item) => {
29
29
  };
30
30
  const onEdgeAbs = (edgeInfo) => {
31
31
  if (edgeInfo.direction == EdgeDirection.left) {
32
- foucsHub.setFocus("mw");
32
+ focusHub.setFocus("mw");
33
33
  }
34
34
  };
35
35
  </script>
@@ -13,10 +13,10 @@ import AbsoluteTemplate from "./AbsoluteTemplate.vue";
13
13
  import RelativeTemplate from "./RelativeTemplate.vue";
14
14
 
15
15
  const router = useRouter();
16
- const foucsHub = useFocusHub();
16
+ const focusHub = useFocusHub();
17
17
 
18
18
  const onFocus = () => {
19
- foucsHub.setFocus("button");
19
+ focusHub.setFocus("button");
20
20
  };
21
21
  const onKeyDown = (ev) => {
22
22
  if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
@@ -12,7 +12,7 @@ import { useFocusHub } from "jsview";
12
12
  import { simpleData } from "../data";
13
13
  import Item from "../Item.vue";
14
14
 
15
- const foucsHub = useFocusHub();
15
+ const focusHub = useFocusHub();
16
16
  const mwRef = ref(null);
17
17
 
18
18
  const wholePageSlide = new WholePageSlide();
@@ -34,9 +34,9 @@ const onEdge = (edgeInfo) => {
34
34
  // MetroWidget焦点到达边缘后的回调
35
35
  if (edgeInfo.direction == EdgeDirection.top) {
36
36
  buttonFocus.value = true;
37
- foucsHub.setFocus("button");
37
+ focusHub.setFocus("button");
38
38
  } else if (edgeInfo.direction == EdgeDirection.right) {
39
- foucsHub.setFocus("mwAbs");
39
+ focusHub.setFocus("mwAbs");
40
40
  }
41
41
  };
42
42
 
@@ -45,7 +45,7 @@ const buttonOnKeyDown = (ev) => {
45
45
  switch (ev.keyCode) {
46
46
  case 40:
47
47
  buttonFocus.value = false;
48
- foucsHub.setFocus("mw");
48
+ focusHub.setFocus("mw");
49
49
  return true;
50
50
  case 13:
51
51
  if (innerData.length == simpleData.length) {
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-11 14:00:33
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-12 14:35:01
5
+ * @LastEditTime: 2022-11-02 15:23:08
6
6
  * @Description: file content
7
7
  */
8
8
 
@@ -177,6 +177,7 @@ for (let i = 0; i < 10; i++) {
177
177
  height: 170,
178
178
  name: "widget_" + i,
179
179
  marginBottom: 10,
180
+ index: i,
180
181
  });
181
182
  }
182
183
 
@@ -5,6 +5,7 @@ import {
5
5
  JsvPreload,
6
6
  buildPreloadInfo,
7
7
  buildDownloadInfo,
8
+ useFocusHub,
8
9
  } from "jsview";
9
10
  import awesome from "./images/awesomeface.png";
10
11
  import cat from "./images/cat.jpg";
@@ -14,11 +15,11 @@ import { ref } from "vue";
14
15
  import { useRouter } from "vue-router";
15
16
 
16
17
  const name = "/preload";
18
+ const focusHub = useFocusHub();
17
19
  const text = ref("");
18
- let = preloadInfo = [];
19
- let = downloadInfo = [];
20
+ let preloadInfo = [];
21
+ let downloadInfo = [];
20
22
  const router = useRouter();
21
- let focusNode = ref(null);
22
23
 
23
24
  const _onPreloading = (percent) => {
24
25
  console.log("preloading ", percent);
@@ -28,9 +29,9 @@ const _onPreloadDone = (imageInfo) => {
28
29
  console.log("PRELOAD DONE!", imageInfo);
29
30
  };
30
31
 
31
- const _onDownloadDone = () => {
32
- console.log("DOWNLOAD DONE!");
33
- this.text = `图片下载完成\n${awesome}\n${cat}`;
32
+ const _onDownloadDone = (urls, extra) => {
33
+ console.log("DOWNLOAD DONE!", urls, extra);
34
+ text.value = `图片下载完成\n${awesome}\n${cat}`;
34
35
  };
35
36
 
36
37
  const _measures = () => {
@@ -43,13 +44,13 @@ const _measures = () => {
43
44
 
44
45
  const _onKeyDown = (ev) => {
45
46
  if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
46
- router.go(-1); // 有router时,是从DemoHomepage进入,回退
47
+ router?.go(-1); // 有router时,是从DemoHomepage进入,回退
47
48
  }
48
49
  return true;
49
50
  };
50
51
 
51
52
  const _onFocus = () => {
52
- focusNode.value.findBlockByName(name).requestFocus();
53
+ focusHub.setFocus(name);
53
54
  };
54
55
 
55
56
  for (const item of data) {
@@ -58,16 +59,20 @@ for (const item of data) {
58
59
  }
59
60
  preloadInfo.push(null); // 测试item为null的加载
60
61
  downloadInfo = [
61
- buildDownloadInfo(awesome),
62
- buildDownloadInfo(cat),
62
+ buildDownloadInfo(awesome, null, true),
63
+ buildDownloadInfo(cat, null, true),
63
64
  buildDownloadInfo(null), // 测试URL为null的加载
64
65
  ];
65
66
  </script>
66
67
 
67
68
  <template>
68
69
  <jsv-focus-block
69
- ref="focusNode"
70
70
  autoFocus
71
+ :style="{
72
+ width: 1920,
73
+ height: 1080,
74
+ backgroundColor: '#FFFFFF',
75
+ }"
71
76
  :onAction="{
72
77
  onKeyDown: _onKeyDown,
73
78
  onFocus: _onFocus,
@@ -0,0 +1,107 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-10-24 13:19:41
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-10-24 13:50:18
6
+ * @Description: file content
7
+ -->
8
+ <script setup>
9
+ import { useRouter } from "vue-router";
10
+ const router = useRouter();
11
+
12
+ const test1 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_1.jpeg)";
13
+ const test2 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_2.jpeg)";
14
+ const test3 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_3.jpeg)";
15
+ const test4 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_4.jpeg)";
16
+
17
+ const onKeyDown = (ev) => {
18
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
19
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
20
+ if (window.JsView) {
21
+ window.JsView.setGlobalConfig({
22
+ texCache: -1,
23
+ });
24
+ }
25
+
26
+ router.go(-1); // 有router时,回退
27
+ return true;
28
+ }
29
+ return false;
30
+ };
31
+
32
+ const style1 = {
33
+ left: 0,
34
+ top: 0,
35
+ width: 250,
36
+ height: 250,
37
+ borderRadius: "15px",
38
+ };
39
+
40
+ const style2 = {
41
+ left: 0,
42
+ top: 260,
43
+ width: 250,
44
+ height: 250,
45
+ borderRadius: "15px",
46
+ };
47
+ </script>
48
+ <template>
49
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown">
50
+ <div class="allBgc">
51
+ <div class="block">
52
+ <div :style="{ left: 0, top: 0 }">
53
+ <div class="leftFont top0">
54
+ {{ `原图加载` }}
55
+ </div>
56
+ <div class="leftFont top250">
57
+ {{ `使用缩小算法优化` }}
58
+ </div>
59
+ </div>
60
+
61
+ <div :style="{ left: 120, top: 0 }">
62
+ <img alt="" :style="style1" :src="test4" />
63
+ <img alt="" :style="style2" jsvImgScaledownTex :src="test4" />
64
+ </div>
65
+
66
+ <div :style="{ left: 380, top: 0 }">
67
+ <img alt="" :style="style1" :src="test1" />
68
+ <img alt="" :style="style2" jsvImgScaledownTex :src="test1" />
69
+ </div>
70
+
71
+ <div :style="{ left: 640, top: 0 }">
72
+ <img alt="" :style="style1" :src="test2" />
73
+ <img alt="" :style="style2" jsvImgScaledownTex :src="test2" />
74
+ </div>
75
+
76
+ <div :style="{ left: 900, top: 0 }">
77
+ <img alt="" :style="style1" :src="test3" />
78
+ <img alt="" :style="style2" jsvImgScaledownTex :src="test3" />
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </jsv-focus-block>
83
+ </template>
84
+ <style scoped>
85
+ .allBgc {
86
+ width: 1920;
87
+ height: 1080;
88
+ background-color: #334c4c;
89
+ }
90
+ .block {
91
+ left: 20;
92
+ top: 50;
93
+ }
94
+ .leftFont {
95
+ left: 0;
96
+ width: 100;
97
+ height: 200;
98
+ color: #ffffff;
99
+ font-size: 25px;
100
+ }
101
+ .top0 {
102
+ top: 0;
103
+ }
104
+ .top250 {
105
+ top: 250;
106
+ }
107
+ </style>
@@ -7,19 +7,14 @@
7
7
  * JsvTextBox:Vue高阶组件,文字的垂直对齐方式显示控件
8
8
  * props说明:
9
9
  * verticalAlign {string} 垂直对齐方式 (必需) top、middle、bottom
10
- * stylesList {array} 布局样式(必需),数组中可包含样式对象或者JsvStyleClass,或者JsvTextStyleClass对象,
11
- * 样式对象内容为{left:0, top:0, width:xxx, height:xxx},
12
- * 布局样式为数组中所有样式的合并。
13
- * styleToken {string} 类似于vue html元素的key,当style变化时,由使用者改变此Token通知hoc进行style重新识别。
14
- * Token不变的场景,props变化不会引起render,以提高渲染性能
10
+ * style {object} 样式(必需)
15
11
  *
16
12
  * 【技巧说明】
17
13
  * Q: 如何实现文字居中对齐方式显示?
18
14
  * A: verticalAlign属性设置为middle
19
15
  *
20
16
  * Q: 如何触发控件重绘?
21
- * A: 1. 变更styleToken属性,将触发控件重新解析styles并重绘
22
- * 2. 变更文字内容,将触发控件重绘,但不会重新解析styles
17
+ * A: 1. 变更文字内容,将触发控件重绘,但不会重新解析styles
23
18
  -->
24
19
 
25
20
  <script setup>
@@ -27,7 +22,6 @@ import RenderLeft from "./RenderLeft.vue";
27
22
  import RenderRight from "./RenderRight.vue";
28
23
  import RenderCenter from "./RenderCenter.vue";
29
24
  import RenderOneLine from "./RenderOneLine.vue";
30
- import { JsvTextStyleClass, JsvStyleClass } from "jsview";
31
25
  import { ref } from "vue";
32
26
  import { useRouter } from "vue-router";
33
27
 
@@ -41,53 +35,7 @@ const text = `静夜思 --唐李白
41
35
  const text_latex = `静夜思 --唐李白
42
36
  床前\\textcolor{#FF0000}{明月光},疑是地上霜;
43
37
  举头\\textcolor{#0000FF}{望明月},低头思故乡。`;
44
- const sLayoutSet = new JsvStyleClass({
45
- width: 400,
46
- height: 300,
47
- backgroundColor: "rgba(255,255,0,0.5)",
48
- });
49
- const sFontSetLeft40Top = new JsvTextStyleClass({
50
- fontSize: "30px", // 测试 30 和 '30px' 两种写法的兼容性
51
- textAlign: "left",
52
- lineHeight: "40px",
53
- });
54
- const sFontSetLeft40Center = new JsvTextStyleClass({
55
- fontSize: "30px", // 测试 30 和 '30px' 两种写法的兼容性
56
- textAlign: "left",
57
- lineHeight: "40px",
58
- });
59
- const sFontSetLeft40Bottom = new JsvTextStyleClass({
60
- fontSize: "30px",
61
- textAlign: "left",
62
- lineHeight: "40px",
63
- });
64
- const sFontSetLeft80 = new JsvTextStyleClass({
65
- fontSize: "30px",
66
- textAlign: "left",
67
- lineHeight: "80px",
68
- });
69
- const sFontSetCenter40 = new JsvTextStyleClass({
70
- fontSize: "30px",
71
- textAlign: "center",
72
- lineHeight: "40px",
73
- });
74
- const sFontSetCenter80 = new JsvTextStyleClass({
75
- fontSize: "30px",
76
- textAlign: "center",
77
- lineHeight: "80px",
78
- });
79
- const sFontSetRight40 = new JsvTextStyleClass({
80
- fontSize: "30px",
81
- textAlign: "right",
82
- lineHeight: "80px",
83
- });
84
- const sFontSetRight80 = new JsvTextStyleClass({
85
- fontSize: "30px",
86
- textAlign: "right",
87
- lineHeight: "80px",
88
- });
89
- const sStyleToken = "v1.0";
90
- const rootRef = ref(null);
38
+
91
39
  const moveCount = ref(0);
92
40
 
93
41
  const onKeyDown = (ev) => {
@@ -133,32 +81,10 @@ const onBlur = () => {
133
81
  }"
134
82
  >
135
83
  <div :style="{ top: offsetY, left: offsetX }">
136
- <RenderLeft
137
- :text="text"
138
- :moveCount="moveCount"
139
- :sStyleToken="sStyleToken"
140
- :sLayoutSet="sLayoutSet"
141
- :sFontSetLeft40Top="sFontSetLeft40Top"
142
- :sFontSetLeft40Center="sFontSetLeft40Center"
143
- :sFontSetLeft40Bottom="sFontSetLeft40Bottom"
144
- :sFontSetLeft80="sFontSetLeft80"
145
- />
146
- <RenderRight
147
- :text="text"
148
- :sStyleToken="sStyleToken"
149
- :sLayoutSet="sLayoutSet"
150
- :sFontSetRight40="sFontSetRight40"
151
- :sFontSetRight80="sFontSetRight80"
152
- />
153
- <RenderCenter
154
- :text="text"
155
- :text_latex="text_latex"
156
- :sStyleToken="sStyleToken"
157
- :sLayoutSet="sLayoutSet"
158
- :sFontSetCenter40="sFontSetCenter40"
159
- :sFontSetCenter80="sFontSetCenter80"
160
- />
161
- <RenderOneLine :text="onLineText" :sStyleToken="sStyleToken" />
84
+ <RenderLeft :text="text" :moveCount="moveCount" />
85
+ <RenderRight :text="text" />
86
+ <RenderCenter :text="text" :text_latex="text_latex" />
87
+ <RenderOneLine :text="onLineText" />
162
88
  </div>
163
89
  </jsv-focus-block>
164
90
  </template>
@@ -4,10 +4,6 @@ export default {
4
4
  props: {
5
5
  text: String,
6
6
  text_latex: String,
7
- sStyleToken: String,
8
- sLayoutSet: Object,
9
- sFontSetCenter40: Object,
10
- sFontSetCenter80: Object,
11
7
  },
12
8
  components: { JsvTextBox },
13
9
  };
@@ -31,8 +27,16 @@ export default {
31
27
  </div>
32
28
  <JsvTextBox
33
29
  :verticalAlign="'top'"
34
- :styleToken="sStyleToken"
35
- :stylesList="[sLayoutSet, sFontSetCenter40, { left: 0, top: 0 }]"
30
+ :style="{
31
+ left: 0,
32
+ top: 0,
33
+ width: 400,
34
+ height: 300,
35
+ backgroundColor: 'rgba(255,255,0,0.5)',
36
+ fontSize: '30px',
37
+ textAlign: 'center',
38
+ lineHeight: '40px',
39
+ }"
36
40
  >
37
41
  {{ `[TC]${text}` }}
38
42
  </JsvTextBox>
@@ -52,8 +56,16 @@ export default {
52
56
  </div>
53
57
  <JsvTextBox
54
58
  :verticalAlign="'middle'"
55
- :styleToken="sStyleToken"
56
- :stylesList="[sLayoutSet, sFontSetCenter40, { left: 410, top: 0 }]"
59
+ :style="{
60
+ left: 410,
61
+ top: 0,
62
+ width: 400,
63
+ height: 300,
64
+ backgroundColor: 'rgba(255,255,0,0.5)',
65
+ fontSize: '30px',
66
+ textAlign: 'center',
67
+ lineHeight: '40px',
68
+ }"
57
69
  :enableLatex="true"
58
70
  >
59
71
  {{ `[MC]${text_latex}` }}
@@ -74,8 +86,16 @@ export default {
74
86
  </div>
75
87
  <JsvTextBox
76
88
  :verticalAlign="'bottom'"
77
- :styleToken="sStyleToken"
78
- :stylesList="[sLayoutSet, sFontSetCenter40, { left: 820, top: 0 }]"
89
+ :style="{
90
+ left: 820,
91
+ top: 0,
92
+ width: 400,
93
+ height: 300,
94
+ backgroundColor: 'rgba(255,255,0,0.5)',
95
+ fontSize: '30px',
96
+ textAlign: 'center',
97
+ lineHeight: '40px',
98
+ }"
79
99
  >
80
100
  {{ `[BC]${text}` }}
81
101
  </JsvTextBox>
@@ -96,12 +116,16 @@ export default {
96
116
  </div>
97
117
  <JsvTextBox
98
118
  :verticalAlign="'middle'"
99
- :styleToken="sStyleToken"
100
- :stylesList="[
101
- sLayoutSet,
102
- sFontSetCenter80,
103
- { left: 1240, top: 0, width: 500 },
104
- ]"
119
+ :style="{
120
+ left: 1240,
121
+ top: 0,
122
+ width: 500,
123
+ height: 300,
124
+ backgroundColor: 'rgba(255,255,0,0.5)',
125
+ fontSize: '30px',
126
+ textAlign: 'center',
127
+ lineHeight: '80px',
128
+ }"
105
129
  >
106
130
  {{ `[MC]${text}` }}
107
131
  </JsvTextBox>