@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.
- package/Basic/components/div/DivBackground.vue +13 -25
- package/Basic/components/img/ImageGroup.vue +14 -20
- package/Basic/components/img/ImgLayout.vue +59 -68
- package/BasicFocusControl/components/BaseBlock.vue +11 -17
- package/BasicFocusControl/components/MainAreaLeftBlock.vue +2 -2
- package/BasicFocusControl/components/MainAreaRightBlock.vue +2 -2
- package/BasicFocusControl/components/SideBarBlock.vue +2 -2
- package/CssPreprocessor/App.vue +40 -51
- package/CssPreprocessor/Less/App.vue +6 -14
- package/CssPreprocessor/Scss/App.vue +6 -14
- package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +0 -1
- package/CssPreprocessor/Stylus/App.vue +6 -14
- package/CssPreprocessor/utils/ContentBlock.vue +30 -12
- package/CssPreprocessor/utils/ContentList.vue +23 -14
- package/CssPreprocessor/utils/Panel.vue +34 -23
- package/CssPreprocessor/utils/TitleBar.vue +7 -9
- package/DemoHomepage/components/BodyFrame.vue +54 -78
- package/DemoHomepage/components/Dialog.vue +38 -43
- package/DemoHomepage/components/Item.vue +52 -55
- package/DemoHomepage/components/TabFrame.vue +43 -72
- package/DemoHomepage/router.js +1 -1
- package/GiftRain/App.vue +10 -4
- package/GridDemo/App.vue +5 -5
- package/GridDemo/FocusItem.vue +3 -5
- package/GridDemo/Item.vue +4 -24
- package/HashHistory/App.vue +0 -10
- package/HashHistory/views/MainPage.vue +0 -1
- package/ImpactStop/App.vue +0 -1
- package/Input/App.vue +106 -150
- package/Input/FullKeyboard.vue +18 -28
- package/Input/InputPanel.vue +87 -109
- package/Input/KeyboardItem.vue +35 -45
- package/JsvRadarChart/App.vue +16 -19
- package/LongImage/Button.vue +2 -3
- package/LongText/App.vue +0 -3
- package/LongText/Button.vue +0 -1
- package/LongText/LongTextScroll.vue +0 -4
- package/Marquee/App.vue +1 -0
- package/MetroWidgetDemos/PerformanceTest/App.vue +2 -3
- package/MetroWidgetDemos/PerformanceTest/Item.vue +52 -55
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +26 -26
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +86 -95
- package/MetroWidgetDemos/PingPong/App.vue +56 -89
- package/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
- package/MetroWidgetDemos/PingPong/Item.vue +1 -1
- package/MetroWidgetDemos/PingPong/TabItem.vue +3 -3
- package/MetroWidgetDemos/PingPong/WidgetItem.vue +1 -1
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +2 -4
- package/MetroWidgetDemos/basic/Item.vue +1 -1
- package/MetroWidgetDemos/direction/App.vue +0 -2
- package/MetroWidgetDemos/direction/Item.vue +1 -1
- package/MetroWidgetDemos/focusableItemBasic/App.vue +1 -1
- package/MetroWidgetDemos/focusableItemBasic/ButtonItem.vue +1 -1
- package/MetroWidgetDemos/focusableItemMetroWidget/App.vue +1 -1
- package/MetroWidgetDemos/focusableItemMetroWidget/Item.vue +1 -1
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +1 -1
- package/MetroWidgetDemos/focusableItemMix/App.vue +1 -1
- package/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +1 -1
- package/MetroWidgetDemos/focusableItemMix/Item.vue +1 -1
- package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +23 -25
- package/MetroWidgetDemos/layoutType/App.vue +0 -2
- package/MetroWidgetDemos/layoutType/Item.vue +1 -1
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +0 -1
- package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +1 -1
- package/MetroWidgetDemos/padding/App.vue +0 -2
- package/MetroWidgetDemos/padding/Item.vue +1 -1
- package/MetroWidgetDemos/slideSetting/Item.vue +1 -1
- package/MockjsDemo/App.vue +26 -11
- package/MockjsDemo/mock/index.js +9 -1
- package/QrcodeDemo/App.vue +0 -1
- package/SoundPool/App.vue +1 -2
- package/SpriteImage/App.vue +89 -125
- package/Swiper/App.vue +1 -3
- package/TestNativeSharedView/App.vue +104 -48
- package/TextBox/RenderCenter.vue +89 -113
- package/TextBox/RenderLeft.vue +89 -113
- package/TextBox/RenderOneLine.vue +7 -10
- package/TextBox/RenderRight.vue +8 -11
- package/TextShadowDemo/App.vue +54 -75
- package/TextureAnimation/App.vue +175 -287
- package/TextureAnimation/App2.vue +1 -5
- package/ThrowMoveDemo/AccelerateDemo.vue +40 -71
- package/ThrowMoveDemo/App.vue +13 -23
- package/ThrowMoveDemo/TargetDemo.vue +24 -53
- package/ThrowMoveDemo/UDParabolicDemo.vue +31 -60
- package/VideoDemo/App.vue +71 -116
- package/package.json +1 -1
- package/VideoDemo/components/Button.vue +0 -58
- package/VideoDemo/components/Controllor.vue +0 -197
- package/VideoDemo/components/VideoFrame.vue +0 -140
package/Input/InputPanel.vue
CHANGED
|
@@ -1,129 +1,107 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-01-25 10:33:07
|
|
4
|
-
* @
|
|
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 {
|
|
11
|
+
import { shallowRef} from "vue";
|
|
11
12
|
|
|
12
13
|
const blurColor = "#AAAAAA";
|
|
13
14
|
const focusColor = "#FFFF00";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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>
|
package/Input/KeyboardItem.vue
CHANGED
|
@@ -1,58 +1,48 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
9
|
+
})
|
|
10
|
+
const focused = shallowRef(false)
|
|
11
|
+
|
|
12
|
+
const style = computed(() => {
|
|
11
13
|
return {
|
|
12
|
-
|
|
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:
|
|
18
|
+
lineHeight: props.data.height,
|
|
23
19
|
color: "#FFFFFF",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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>
|
package/JsvRadarChart/App.vue
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
<template>
|
|
9
9
|
<jsv-focus-block autoFocus :onAction="actionDefines">
|
|
10
10
|
<div :style="{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 {
|
|
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 ==
|
|
64
|
-
|
|
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
|
|
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
|
|
85
|
+
item.value = 8
|
|
89
86
|
}
|
|
90
87
|
})
|
|
91
88
|
}
|
package/LongImage/Button.vue
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-07-08 15:18:02
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
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
package/LongText/Button.vue
CHANGED
package/Marquee/App.vue
CHANGED
|
@@ -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 {
|
|
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:
|
|
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:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: ZhengYi
|
|
5
|
+
* @LastEditTime: 2023-05-04
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
<script>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|