@shijiu/jsview-vue-samples 2.0.1073 → 2.0.1106

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 (90) hide show
  1. package/Basic/components/div/DivBackground.vue +13 -25
  2. package/Basic/components/img/ImageGroup.vue +14 -20
  3. package/Basic/components/img/ImgLayout.vue +59 -68
  4. package/BasicFocusControl/components/BaseBlock.vue +11 -17
  5. package/BasicFocusControl/components/MainAreaLeftBlock.vue +2 -2
  6. package/BasicFocusControl/components/MainAreaRightBlock.vue +2 -2
  7. package/BasicFocusControl/components/SideBarBlock.vue +2 -2
  8. package/CssPreprocessor/App.vue +40 -51
  9. package/CssPreprocessor/Less/App.vue +6 -14
  10. package/CssPreprocessor/Scss/App.vue +6 -14
  11. package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +0 -1
  12. package/CssPreprocessor/Stylus/App.vue +6 -14
  13. package/CssPreprocessor/utils/ContentBlock.vue +30 -12
  14. package/CssPreprocessor/utils/ContentList.vue +23 -14
  15. package/CssPreprocessor/utils/Panel.vue +34 -23
  16. package/CssPreprocessor/utils/TitleBar.vue +7 -9
  17. package/DemoHomepage/components/BodyFrame.vue +54 -78
  18. package/DemoHomepage/components/Dialog.vue +38 -43
  19. package/DemoHomepage/components/Item.vue +52 -55
  20. package/DemoHomepage/components/TabFrame.vue +43 -72
  21. package/DemoHomepage/router.js +1 -1
  22. package/GiftRain/App.vue +10 -4
  23. package/GridDemo/App.vue +5 -5
  24. package/GridDemo/FocusItem.vue +3 -5
  25. package/GridDemo/Item.vue +4 -24
  26. package/HashHistory/App.vue +0 -10
  27. package/HashHistory/views/MainPage.vue +0 -1
  28. package/ImpactStop/App.vue +0 -1
  29. package/Input/App.vue +106 -150
  30. package/Input/FullKeyboard.vue +18 -28
  31. package/Input/InputPanel.vue +87 -109
  32. package/Input/KeyboardItem.vue +35 -45
  33. package/JsvRadarChart/App.vue +16 -19
  34. package/LongImage/Button.vue +2 -3
  35. package/LongText/App.vue +0 -3
  36. package/LongText/Button.vue +0 -1
  37. package/LongText/LongTextScroll.vue +0 -4
  38. package/Marquee/App.vue +1 -0
  39. package/MetroWidgetDemos/PerformanceTest/App.vue +2 -3
  40. package/MetroWidgetDemos/PerformanceTest/Item.vue +52 -55
  41. package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +26 -26
  42. package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +86 -95
  43. package/MetroWidgetDemos/PingPong/App.vue +56 -89
  44. package/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
  45. package/MetroWidgetDemos/PingPong/Item.vue +1 -1
  46. package/MetroWidgetDemos/PingPong/TabItem.vue +3 -3
  47. package/MetroWidgetDemos/PingPong/WidgetItem.vue +1 -1
  48. package/MetroWidgetDemos/SkeletonDiagram/App.vue +2 -4
  49. package/MetroWidgetDemos/basic/Item.vue +1 -1
  50. package/MetroWidgetDemos/direction/App.vue +0 -2
  51. package/MetroWidgetDemos/direction/Item.vue +1 -1
  52. package/MetroWidgetDemos/focusableItemBasic/App.vue +1 -1
  53. package/MetroWidgetDemos/focusableItemBasic/ButtonItem.vue +1 -1
  54. package/MetroWidgetDemos/focusableItemMetroWidget/App.vue +1 -1
  55. package/MetroWidgetDemos/focusableItemMetroWidget/Item.vue +1 -1
  56. package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +1 -1
  57. package/MetroWidgetDemos/focusableItemMix/App.vue +1 -1
  58. package/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +1 -1
  59. package/MetroWidgetDemos/focusableItemMix/Item.vue +1 -1
  60. package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +23 -25
  61. package/MetroWidgetDemos/layoutType/App.vue +0 -2
  62. package/MetroWidgetDemos/layoutType/Item.vue +1 -1
  63. package/MetroWidgetDemos/ninePatchFocusPage/App.vue +0 -1
  64. package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +1 -1
  65. package/MetroWidgetDemos/padding/App.vue +0 -2
  66. package/MetroWidgetDemos/padding/Item.vue +1 -1
  67. package/MetroWidgetDemos/slideSetting/Item.vue +1 -1
  68. package/MockjsDemo/App.vue +26 -11
  69. package/MockjsDemo/mock/index.js +9 -1
  70. package/QrcodeDemo/App.vue +0 -1
  71. package/SoundPool/App.vue +1 -2
  72. package/SpriteImage/App.vue +89 -125
  73. package/Swiper/App.vue +1 -3
  74. package/TestNativeSharedView/App.vue +104 -48
  75. package/TextBox/RenderCenter.vue +89 -113
  76. package/TextBox/RenderLeft.vue +89 -113
  77. package/TextBox/RenderOneLine.vue +7 -10
  78. package/TextBox/RenderRight.vue +8 -11
  79. package/TextShadowDemo/App.vue +54 -75
  80. package/TextureAnimation/App.vue +175 -287
  81. package/TextureAnimation/App2.vue +1 -5
  82. package/ThrowMoveDemo/AccelerateDemo.vue +40 -71
  83. package/ThrowMoveDemo/App.vue +13 -23
  84. package/ThrowMoveDemo/TargetDemo.vue +24 -53
  85. package/ThrowMoveDemo/UDParabolicDemo.vue +31 -60
  86. package/VideoDemo/App.vue +71 -116
  87. package/package.json +1 -1
  88. package/VideoDemo/components/Button.vue +0 -58
  89. package/VideoDemo/components/Controllor.vue +0 -197
  90. package/VideoDemo/components/VideoFrame.vue +0 -140
@@ -1,129 +1,107 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-01-25 10:33:07
4
- * @LastEditTime: 2023-02-01 13:46:07
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-04-28
5
6
  * @Description: file content
6
7
  -->
7
- <script>
8
+ <script setup>
8
9
  import FullKeyboard from "./FullKeyboard.vue";
9
10
  import { EdgeDirection, JsvInput, useFocusHub } from "jsview";
10
- import { ref } from "vue";
11
+ import { shallowRef} from "vue";
11
12
 
12
13
  const blurColor = "#AAAAAA";
13
14
  const focusColor = "#FFFF00";
14
-
15
- export default {
16
- components: {
17
- FullKeyboard,
18
- JsvInput,
19
- },
20
- props: {
15
+ let focusNode = shallowRef(null)
16
+ let input=shallowRef(null)
17
+ let showCursor = shallowRef(false)
18
+ const focusHub = useFocusHub()
19
+ let cursorColor = shallowRef(blurColor)
20
+ const props = defineProps({
21
21
  name: String,
22
22
  type: Number,
23
23
  textAlign: String,
24
24
  placeHolder: String,
25
25
  onEdge: Function,
26
- },
27
- setup() {
28
- return {
29
- showCursor: ref(false),
30
- focusHub: useFocusHub(),
31
- cursorColor: ref(blurColor),
32
- };
33
- },
34
- methods: {
35
- _onFocus() {
36
- this.showCursor = true;
37
- this.cursorColor = blurColor;
38
- this.focusHub.setFocus(`${this.name}/keyboard`);
39
- },
40
- _onBlur() {
41
- this.showCursor = false;
42
- this.cursorColor = blurColor;
43
- },
44
- _keyboardOnClick(item) {
45
- const char = item.content;
46
- if (char === "删除") {
47
- this.$refs.input?.delete();
48
- } else if (char === "清空") {
49
- this.$refs.input?.clear();
50
- } else {
51
- this.$refs.input?.add(char);
52
- }
53
- },
54
- _keyboardOnEdge(edgeInfo) {
55
- if (edgeInfo.direction === EdgeDirection.top) {
56
- this.focusHub.setFocus(`${this.name}/etext`);
57
- this.cursorColor = focusColor;
58
- } else {
59
- this.onEdge?.(edgeInfo);
60
- }
61
- },
62
- _onTextChange(str) {
63
- console.log(this.name + " text change:", str);
64
- },
65
- _onTextOverflow() {
66
- console.log(this.name + " text overflow.");
67
- },
68
- _inputOnEdge(edgeInfo) {
69
- if (edgeInfo.direction === EdgeDirection.bottom) {
70
- this.focusHub.setFocus(`${this.name}/keyboard`);
71
- this.cursorColor = blurColor;
72
- } else {
73
- this.onEdge?.(edgeInfo);
74
- }
75
- return true;
76
- },
77
- },
78
- };
26
+ })
27
+ const _onFocus = () => {
28
+ showCursor.value = true;
29
+ cursorColor.value = blurColor;
30
+ focusHub.setFocus(`${props.name}/keyboard`);
31
+ }
32
+ const _onBlur = () => {
33
+ showCursor.value = false;
34
+ cursorColor.value = blurColor;
35
+ }
36
+ const _keyboardOnClick = (item) => {
37
+ const char = item.content;
38
+ if (char === "删除") {
39
+ input.value?.delete();
40
+ } else if (char === "清空") {
41
+ input.value?.clear();
42
+ } else {
43
+ input.value?.add(char);
44
+ }
45
+ }
46
+ const _keyboardOnEdge = (edgeInfo) => {
47
+ if (edgeInfo.direction === EdgeDirection.top) {
48
+ focusHub.setFocus(`${props.name}/etext`);
49
+ cursorColor.value = focusColor;
50
+ } else {
51
+ props.onEdge?.(edgeInfo);
52
+ }
53
+ }
54
+ const _onTextChange = (str) => {
55
+ console.log(props.name + " text change:", str);
56
+ }
57
+ const _onTextOverflow = () => {
58
+ console.log(props.name + " text overflow.");
59
+ }
60
+ const _inputOnEdge = (edgeInfo) => {
61
+ if (edgeInfo.direction === EdgeDirection.bottom) {
62
+ focusHub.setFocus(`${props.name}/keyboard`);
63
+ cursorColor.value = blurColor;
64
+ } else {
65
+ props.onEdge?.(edgeInfo);
66
+ }
67
+ return true;
68
+ }
79
69
  </script>
80
70
 
81
71
  <template>
82
- <jsv-focus-block
83
- :name="name"
84
- ref="focusNode"
85
- :onAction="{
86
- onFocus: _onFocus,
87
- onBlur: _onBlur,
88
- }"
89
- >
90
- <div
91
- :style="{
92
- left: 50,
93
- top: 50,
94
- width: 150,
95
- height: 40,
96
- backgroundColor: '#33334f',
97
- }"
98
- />
99
- <jsv-input
100
- :name="`${this.name}/etext`"
101
- ref="input"
102
- :type="type"
103
- :left="50"
104
- :top="50"
105
- :height="40"
106
- :width="150"
107
- :placeholder="placeHolder"
108
- :cursorShow="showCursor"
109
- :fontStyle="{
110
- fontSize: 28,
111
- color: '#ffff00',
112
- textAlign: textAlign,
113
- }"
114
- :onEdge="_inputOnEdge"
115
- :cursorWidth="2"
116
- :onTextChange="_onTextChange"
117
- :onTextOverflow="_onTextOverflow"
118
- :cursorColor="cursorColor"
119
- />
72
+ <jsv-focus-block :name="props.name" ref="focusNode" :onAction="{
73
+ onFocus: _onFocus,
74
+ onBlur: _onBlur,
75
+ }">
76
+ <div :style="{
77
+ left: 50,
78
+ top: 50,
79
+ width: 150,
80
+ height: 40,
81
+ backgroundColor: '#33334f',
82
+ }" />
83
+ <jsv-input :name="`${props.name}/etext`"
84
+ ref="input"
85
+ :type="props.type"
86
+ :left="50"
87
+ :top="50"
88
+ :height="40"
89
+ :width="150"
90
+ :placeholder="props.placeHolder"
91
+ :cursorShow="showCursor"
92
+ :fontStyle="{
93
+ fontSize: 28,
94
+ color: '#ffff00',
95
+ textAlign: props.textAlign,
96
+ }"
97
+ :onEdge="_inputOnEdge"
98
+ :cursorWidth="2"
99
+ :onTextChange="_onTextChange"
100
+ :onTextOverflow="_onTextOverflow"
101
+ :cursorColor="cursorColor" />
120
102
 
121
- <div :style="{ top: 100 }">
122
- <full-keyboard
123
- :name="`${this.name}/keyboard`"
124
- :onClick="_keyboardOnClick"
125
- :onEdge="_keyboardOnEdge"
126
- />
127
- </div>
128
- </jsv-focus-block>
103
+ <div :style="{ top: 100 }">
104
+ <full-keyboard :name="`${props.name}/keyboard`" :onClick="_keyboardOnClick" :onEdge="_keyboardOnEdge" />
105
+ </div>
106
+ </jsv-focus-block>
129
107
  </template>
@@ -1,58 +1,48 @@
1
- <script>
2
- export default {
3
- props: {
1
+ <script setup>
2
+ import { shallowRef,computed } from "vue"
3
+ const props = defineProps({
4
4
  data: Object,
5
5
  query: Object,
6
6
  onEdge: Function,
7
7
  onAction: Object,
8
8
  onClick: Function,
9
- },
10
- data() {
9
+ })
10
+ const focused = shallowRef(false)
11
+
12
+ const style = computed(() => {
11
13
  return {
12
- focused: false,
13
- };
14
- },
15
- computed: {
16
- style() {
17
- return {
18
- width: this.data.width,
19
- height: this.data.height,
14
+ width: props.data.width,
15
+ height: props.data.height,
20
16
  fontSize: 20,
21
17
  textAlign: "center",
22
- lineHeight: this.data.height,
18
+ lineHeight: props.data.height,
23
19
  color: "#FFFFFF",
24
- };
25
- },
26
- },
27
- methods: {
28
- _onFocus() {
29
- this.focused = true;
30
- },
31
- _onBlur() {
32
- this.focused = false;
33
- },
34
- _onClick() {
35
- this.onClick(this.data);
36
- },
37
- },
38
- created() {
39
- this.onAction.register("onFocus", this._onFocus);
40
- this.onAction.register("onBlur", this._onBlur);
41
- this.onAction.register("onClick", this._onClick);
42
- },
43
- };
20
+ };
21
+ })
22
+ const _onFocus = () => {
23
+ focused.value = true;
24
+ }
25
+ const _onBlur = () => {
26
+ focused.value = false;
27
+ }
28
+ const _onClick = () => {
29
+ props.onClick(props.data);
30
+ }
31
+
32
+ props.onAction.register("onFocus", _onFocus);
33
+ props.onAction.register("onBlur", _onBlur);
34
+ props.onAction.register("onClick", _onClick);
35
+
36
+
44
37
  </script>
45
38
 
46
39
  <template>
47
- <div
48
- v-if="focused"
49
- :style="{
50
- width: data.width,
51
- height: data.height,
52
- backgroundColor: '#00FF00',
53
- }"
54
- />
55
- <div ref="element" :style="style">
56
- {{ data.content }}
57
- </div>
40
+ <div v-if="focused" :style="{
41
+ width: props.data.width,
42
+ height: props.data.height,
43
+ backgroundColor: '#00FF00',
44
+ }" />
45
+ <div ref="element" :style="style">
46
+ {{ props.data.content }}
47
+ </div>
58
48
  </template>
@@ -8,16 +8,16 @@
8
8
  <template>
9
9
  <jsv-focus-block autoFocus :onAction="actionDefines">
10
10
  <div :style="{
11
- textAlign: 'center',
12
- fontSize: 30,
13
- lineHeight: 50,
14
- color: '#ffffff',
15
- left: 100,
16
- top: 20,
17
- width: 1280 - 200,
18
- height: 50,
19
- backgroundColor: 'rgba(27,38,151,0.8)',
20
- }">按左键各个方向随机减少,按右键各个方向随机增加</div>
11
+ textAlign: 'center',
12
+ fontSize: 30,
13
+ lineHeight: 50,
14
+ color: '#ffffff',
15
+ left: 100,
16
+ top: 20,
17
+ width: 1280 - 200,
18
+ height: 50,
19
+ backgroundColor: 'rgba(27,38,151,0.8)',
20
+ }">按左键各个方向随机减少,按右键各个方向随机增加</div>
21
21
  <JsvRadarChart :data="data" :backgroundUrl="bgImageUrl" :foregroundUrl="resultSquare" :style="style"
22
22
  :fontSize="fontSize" :extendOffset="70" :fontColor="'#ff3212'" :radius="200" />
23
23
  <JsvRadarChart :data="data2" :backgroundUrl="bgImageUrl" :foregroundUrl="resultSquare" :style="style2"
@@ -29,10 +29,7 @@
29
29
  import { JsvRadarChart } from "jsview";
30
30
  import resultSquare from "./assets/resultSquare.png"
31
31
  import bgImageUrl from "./assets/Square.png"
32
- import { onMounted, ref } from 'vue';
33
- import { jJsvRuntimeBridge } from 'jsview';
34
- import { useRouter } from "vue-router";
35
- const router = useRouter();
32
+ import { ref } from 'vue';
36
33
  const data = ref([
37
34
  { title: '语文', value: 70 },
38
35
  { title: '数学', value: 98 },
@@ -60,9 +57,8 @@ const style2 = {
60
57
  const fontSize = 30;
61
58
 
62
59
  const onKeyDown = (ev) => {
63
- if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
64
- router.go(-1)
65
- } else if (ev.keyCode == 39) {
60
+ if (ev.keyCode == 39) {
61
+ console.log('测试用:按下了右键');
66
62
  data.value.forEach((item, index) => {
67
63
  item.value += Math.random() * 10
68
64
  if (item.value >= 100) {
@@ -76,16 +72,17 @@ const onKeyDown = (ev) => {
76
72
  }
77
73
  })
78
74
  } else if (ev.keyCode == 37) {
75
+ console.log('测试用:按下了左键');
79
76
  data.value.forEach((item, index) => {
80
77
  item.value -= Math.random() * 10
81
78
  if (item.value <= 10) {
82
- item.value == 8
79
+ item.value = 8
83
80
  }
84
81
  })
85
82
  data2.value.forEach((item, index) => {
86
83
  item.value -= Math.random() * 10
87
84
  if (item.value <= 10) {
88
- item.value == 8
85
+ item.value = 8
89
86
  }
90
87
  })
91
88
  }
@@ -1,12 +1,11 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-08 15:18:02
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-08 17:47:25
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-05-04
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { ref } from "vue";
10
9
  import { HORIZONTAL, MetroWidget, EdgeDirection, useFocusHub } from "jsview";
11
10
  import ButtonItem from "./ButtonItem.vue";
12
11
 
package/LongText/App.vue CHANGED
@@ -2,9 +2,6 @@
2
2
  * 【界面概述】
3
3
  * 协议书的示例
4
4
  *
5
- * 【控件介绍】
6
- * SimpleWidget:见simpleMetrowidget
7
- *
8
5
  * 【技巧说明】
9
6
  * Q: 如何长文字div的高度自适应?
10
7
  * A: 描画长文字的div的高度不设置即可
@@ -1,5 +1,4 @@
1
1
  <script setup>
2
- import { ref } from "vue";
3
2
  import { HORIZONTAL, MetroWidget, EdgeDirection, useFocusHub } from "jsview";
4
3
  import ButtonItem from "./ButtonItem.vue";
5
4
 
@@ -61,10 +61,6 @@ const onAction = {
61
61
  },
62
62
  };
63
63
 
64
- const OnLoad = () => {
65
- // 图片加载完成的回调
66
- console.log("Image loaded!");
67
- };
68
64
  onMounted(() => {
69
65
  rootRef.value.requestFocus();
70
66
  });
package/Marquee/App.vue CHANGED
@@ -143,6 +143,7 @@ onMounted(() => {
143
143
  lineHeight: 70,
144
144
  fontSize: 50,
145
145
  color: '#000000',
146
+ direction: 'rtl',
146
147
  }"
147
148
  :text="rtlText"
148
149
  :slideSpeed="slideSpeed"
@@ -73,10 +73,9 @@
73
73
 
74
74
  <script setup>
75
75
  import { data1, data2, data3 } from "./data";
76
- import borderImgPath from "./border.png";
77
76
  import Item from "./components/ContentItem.vue";
78
77
  import MyTab from "./components/MyTab.vue";
79
- import { ref, shallowRef, onMounted, onBeforeUnmount } from "vue";
78
+ import { shallowRef, onMounted, onBeforeUnmount } from "vue";
80
79
  import { useRouter } from "vue-router";
81
80
  import {
82
81
  VERTICAL,
@@ -195,7 +194,7 @@ onMounted(() => {
195
194
 
196
195
  <style scoped>
197
196
  .rootSize {
198
- top: 0px;
197
+ top: 0;
199
198
  }
200
199
 
201
200
  .widgetPos {
@@ -1,67 +1,64 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-11 18:03:22
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-11 18:03:23
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-05-04
6
6
  * @Description: file content
7
7
  -->
8
- <script>
9
- export default {
10
- props: {
11
- data: Object,
12
- query: Object,
13
- onEdge: Function,
14
- onAction: Object,
15
- },
16
- methods: {
17
- onFocus() {
18
- this.focus = true;
19
- this.anim = "focusScale 0.3s";
20
- },
21
- onBlur() {
22
- this.focus = false;
23
- this.anim = "blurScale 0.3s";
24
- },
25
- onClick() {
26
- console.log("item click");
27
- },
28
- getStyle() {
29
- const width = this.focus
30
- ? (this.data.blocks.w - 10) * (1 / 0.8)
31
- : this.data.blocks.w - 10;
32
- const height = this.focus
33
- ? (this.data.blocks.h - 10) * (1 / 0.8)
34
- : this.data.blocks.h - 10;
35
- const posx = this.focus ? (this.data.blocks.w - 10 - width) / 2 : 0;
36
- const posy = this.focus ? (this.data.blocks.h - 10 - height) / 2 : 0;
37
- return {
38
- left: posx,
39
- top: posy,
40
- width: width,
41
- height: height,
42
- color: "#FFFFFF",
43
- backgroundColor: this.focus ? "#FF0000" : this.data.color,
44
- animation: this.anim,
45
- };
46
- },
47
- },
48
- data() {
49
- return {
50
- focus: false,
51
- anim: null,
52
- };
53
- },
54
- created() {
55
- this.onAction.register("onFocus", this.onFocus);
56
- this.onAction.register("onBlur", this.onBlur);
57
- this.onAction.register("onClick", this.onClick);
58
- },
59
- };
8
+ <script setup>
9
+ import { shallowRef } from "vue"
10
+ const props = defineProps({
11
+ data: Object,
12
+ onAction: Object,
13
+ })
14
+
15
+ let focus = shallowRef(false)
16
+ let anim = shallowRef(null)
17
+
18
+ const onFocus = () => {
19
+ focus.value = true;
20
+ anim.value = "focusScale 0.3s";
21
+ }
22
+
23
+ const onBlur = () => {
24
+ focus.value = false;
25
+ anim.value = "blurScale 0.3s";
26
+ }
27
+
28
+ const onClick = () => {
29
+ console.log("item click");
30
+ }
31
+
32
+ const getStyle = () => {
33
+ const width = focus.value
34
+ ? (props.data.blocks.w - 10) * (1 / 0.8)
35
+ : props.data.blocks.w - 10;
36
+ const height = focus.value
37
+ ? (props.data.blocks.h - 10) * (1 / 0.8)
38
+ : props.data.blocks.h - 10;
39
+ const posx = focus.value ? (props.data.blocks.w - 10 - width) / 2 : 0;
40
+ const posy = focus.value ? (props.data.blocks.h - 10 - height) / 2 : 0;
41
+ return {
42
+ left: posx,
43
+ top: posy,
44
+ width: width,
45
+ height: height,
46
+ color: "#FFFFFF",
47
+ backgroundColor: focus.value ? "#FF0000" : props.data.color,
48
+ animation: anim.value,
49
+ };
50
+ }
51
+
52
+ props.onAction.register("onFocus", onFocus);
53
+ props.onAction.register("onBlur", onBlur);
54
+ props.onAction.register("onClick", onClick);
55
+
56
+
60
57
  </script>
61
58
 
62
59
  <template>
63
60
  <div :style="{ ...getStyle() }">
64
- {{ data.content }}
61
+ {{ props.data.content }}
65
62
  </div>
66
63
  </template>
67
64