@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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script setup>
|
|
2
2
|
import ContentBlock from './ContentBlock.vue';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
3
|
+
import { computed } from "vue"
|
|
4
|
+
/* export default {
|
|
5
5
|
props: {
|
|
6
6
|
style: Object,
|
|
7
7
|
startIndex: Number,
|
|
@@ -15,20 +15,29 @@ export default {
|
|
|
15
15
|
return this.style.height / 4;
|
|
16
16
|
},
|
|
17
17
|
}
|
|
18
|
-
}
|
|
18
|
+
} */
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
style: Object,
|
|
22
|
+
startIndex: Number,
|
|
23
|
+
contentData: Array,
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const rowHeight=computed(()=>{
|
|
27
|
+
return props.style.height / 4;
|
|
28
|
+
})
|
|
19
29
|
</script>
|
|
20
30
|
|
|
21
31
|
<template>
|
|
22
|
-
<div :style=style>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
<div :style=props.style>
|
|
33
|
+
<div v-for="(_, idx) in props.contentData.length" :key=idx>
|
|
34
|
+
<ContentBlock v-if="props.contentData[idx].zoom != 0"
|
|
35
|
+
:style="{ top: rowHeight * idx, width: props.style.width, height: rowHeight * (props.contentData[idx].zoom ?? 1) }"
|
|
36
|
+
:index=props.startIndex + idx :title=props.contentData[idx].title>
|
|
37
|
+
<component :is=props.contentData[idx].obj />
|
|
38
|
+
</ContentBlock>
|
|
39
|
+
</div>
|
|
29
40
|
</div>
|
|
30
|
-
</div>
|
|
31
41
|
</template>
|
|
32
42
|
|
|
33
|
-
<style>
|
|
34
|
-
</style>
|
|
43
|
+
<style></style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script setup>
|
|
2
2
|
import ContentList from './ContentList.vue';
|
|
3
3
|
import TitleBar from './TitleBar.vue';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
4
|
+
import { computed } from "vue"
|
|
5
|
+
/* export default {
|
|
6
6
|
props: {
|
|
7
7
|
style: Object,
|
|
8
8
|
panelData: Object,
|
|
@@ -20,30 +20,41 @@ export default {
|
|
|
20
20
|
return 'rgba(142,175,153,1)'
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
}
|
|
23
|
+
} */
|
|
24
|
+
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
style: Object,
|
|
27
|
+
panelData: Object,
|
|
28
|
+
sideline: Boolean
|
|
29
|
+
})
|
|
30
|
+
const columnWidth=computed(()=>{
|
|
31
|
+
return props.style.width / props.panelData.title.length;
|
|
32
|
+
})
|
|
33
|
+
const separatorColor=computed(()=>{
|
|
34
|
+
return 'rgba(142,175,153,1)'
|
|
35
|
+
})
|
|
24
36
|
</script>
|
|
25
37
|
|
|
26
38
|
<template>
|
|
27
|
-
<div :style=style>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
<div :style=props.style>
|
|
40
|
+
<!-- 分隔线 -->
|
|
41
|
+
<div v-if=props.sideline>
|
|
42
|
+
<div :style="{ width: props.style.width, height: 1, backgroundColor: separatorColor }" />
|
|
43
|
+
<div :style="{ top: props.style.height, width: props.style.width, height: 1, backgroundColor: separatorColor }" />
|
|
44
|
+
<div :style="{ left: 0, width: 1, height: props.style.height, backgroundColor: separatorColor }" />
|
|
45
|
+
<template v-for="(_, idx) in props.panelData.title" :key="idx">
|
|
46
|
+
<div
|
|
47
|
+
:style="{ left: columnWidth * (idx + 1), width: 1, height: props.style.height, backgroundColor: separatorColor }" />
|
|
48
|
+
</template>
|
|
49
|
+
</div>
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
<TitleBar :style="{ width: columnWidth }" :titleData=props.panelData.title />
|
|
52
|
+
<div :style="{ top: 20 }">
|
|
53
|
+
<ContentList v-for="(_, idx) in props.panelData.contentList.length" :key=idx
|
|
54
|
+
:style="{ left: columnWidth * idx, width: columnWidth, height: props.style.height - 20 }" :startIndex=idx
|
|
55
|
+
:contentData=props.panelData.contentList[idx] />
|
|
56
|
+
</div>
|
|
44
57
|
</div>
|
|
45
|
-
</div>
|
|
46
58
|
</template>
|
|
47
59
|
|
|
48
|
-
<style scoped>
|
|
49
|
-
</style>
|
|
60
|
+
<style scoped></style>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
style: Object,
|
|
4
|
+
titleData: Array
|
|
5
|
+
})
|
|
8
6
|
</script>
|
|
9
7
|
|
|
10
8
|
<template>
|
|
11
9
|
<div>
|
|
12
|
-
<template v-for="(title, index) in titleData" :key="index"
|
|
13
|
-
<div class='title-font title-range' :style="{left: style.width * index}">
|
|
10
|
+
<template v-for="(title, index) in props.titleData" :key="index">
|
|
11
|
+
<div class='title-font title-range' :style="{ left: props.style.width * index }">
|
|
14
12
|
{{ title }}
|
|
15
13
|
</div>
|
|
16
14
|
</template>
|
|
@@ -1,93 +1,69 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { watch } from "vue";
|
|
1
|
+
<script setup>
|
|
2
|
+
import { watch, shallowRef } from "vue";
|
|
3
3
|
import { MetroWidget, VERTICAL } from "jsview";
|
|
4
4
|
import Item from "./Item.vue";
|
|
5
|
+
import { useRouter } from "vue-router";
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
let mw = shallowRef(null)
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
data: Array,
|
|
10
|
+
name: String,
|
|
11
|
+
onEdge: Function,
|
|
12
|
+
tabId: Number,
|
|
13
|
+
})
|
|
5
14
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
localStorage.curTab = this.tabId;
|
|
41
|
-
},
|
|
42
|
-
_provideData() {
|
|
43
|
-
return this.data;
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
beforeCreate() {
|
|
47
|
-
if (typeof localStorage.curFocusId !== "undefined") {
|
|
48
|
-
this.initFocusId = parseInt(localStorage.curFocusId);
|
|
49
|
-
}
|
|
50
|
-
localStorage.curFocusId = 0;
|
|
51
|
-
watch(
|
|
52
|
-
() => {
|
|
53
|
-
return this.data;
|
|
54
|
-
},
|
|
55
|
-
() => {
|
|
56
|
-
this.$refs.mw?.refreshData(true);
|
|
57
|
-
}
|
|
58
|
-
);
|
|
15
|
+
const direction = VERTICAL;
|
|
16
|
+
const width = 1280;
|
|
17
|
+
const height = 600;
|
|
18
|
+
let initFocusId = shallowRef(0);
|
|
19
|
+
|
|
20
|
+
const measures = (item) => {
|
|
21
|
+
return {
|
|
22
|
+
width: item.width,
|
|
23
|
+
height: item.height,
|
|
24
|
+
focusable: item.focusable,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const itemClick = (index, data) => {
|
|
29
|
+
if (!data.path) {
|
|
30
|
+
console.error("Route path is not defined.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
router.push(data.path);
|
|
34
|
+
localStorage.curFocusId = index;
|
|
35
|
+
localStorage.curTab = props.tabId;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const _provideData = () => {
|
|
39
|
+
return props.data;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (typeof localStorage.curFocusId !== "undefined") {
|
|
43
|
+
initFocusId.value = parseInt(localStorage.curFocusId);
|
|
44
|
+
}
|
|
45
|
+
localStorage.curFocusId = 0;
|
|
46
|
+
watch(
|
|
47
|
+
() => {
|
|
48
|
+
return props.data;
|
|
59
49
|
},
|
|
60
|
-
|
|
50
|
+
() => {
|
|
51
|
+
mw.value?.refreshData(true);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
61
54
|
</script>
|
|
62
55
|
|
|
63
56
|
<template>
|
|
64
|
-
<metro-widget
|
|
65
|
-
|
|
66
|
-
:
|
|
67
|
-
:width="width"
|
|
68
|
-
:height="height"
|
|
69
|
-
:direction="direction"
|
|
70
|
-
:provideData="_provideData"
|
|
71
|
-
:enableTouch="true"
|
|
72
|
-
:measures="measures"
|
|
73
|
-
:padding="{ left: 10, top: 10, right: 10, bottom: 10 }"
|
|
74
|
-
:onEdge="onEdge"
|
|
75
|
-
:initFocusId="initFocusId"
|
|
76
|
-
>
|
|
57
|
+
<metro-widget ref="mw" :name="props.name" :width="width" :height="height" :direction="direction" :provideData="_provideData"
|
|
58
|
+
:enableTouch="true" :measures="measures" :padding="{ left: 10, top: 10, right: 10, bottom: 10 }"
|
|
59
|
+
:onEdge="props.onEdge" :initFocusId="initFocusId">
|
|
77
60
|
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
78
|
-
<Item
|
|
79
|
-
:style="{
|
|
61
|
+
<Item :style="{
|
|
80
62
|
width: data.width,
|
|
81
63
|
height: data.height,
|
|
82
64
|
backgroundColor: data.backgroundColor,
|
|
83
65
|
color: '#000000',
|
|
84
|
-
}"
|
|
85
|
-
:data="data"
|
|
86
|
-
:query="query"
|
|
87
|
-
:onEdge="onEdge"
|
|
88
|
-
:onAction="onAction"
|
|
89
|
-
:itemClick="itemClick"
|
|
90
|
-
>
|
|
66
|
+
}" :data="data" :query="query" :onEdge="onEdge" :onAction="onAction" :itemClick="itemClick">
|
|
91
67
|
{{ data.name }}
|
|
92
68
|
</Item>
|
|
93
69
|
</template>
|
|
@@ -1,50 +1,43 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
case 37:
|
|
16
|
-
if (this.focusId == 1) {
|
|
17
|
-
this.focusId = 0;
|
|
18
|
-
}
|
|
19
|
-
break;
|
|
20
|
-
case 39:
|
|
21
|
-
if (this.focusId == 0) {
|
|
22
|
-
this.focusId = 1;
|
|
23
|
-
}
|
|
24
|
-
break;
|
|
25
|
-
case 10000:
|
|
26
|
-
case 27:
|
|
27
|
-
this.onAction("back");
|
|
28
|
-
break;
|
|
29
|
-
case 13:
|
|
30
|
-
this.onAction(this.focusId == 0 ? "ok" : "cancel");
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shallowRef } from "vue"
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
name: String,
|
|
5
|
+
onAction: Function,
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
let focusId = shallowRef(0)
|
|
9
|
+
|
|
10
|
+
const onKeyDown = (ev) => {
|
|
11
|
+
switch (ev.keyCode) {
|
|
12
|
+
case 37:
|
|
13
|
+
if (focusId.value == 1) {
|
|
14
|
+
focusId.value = 0;
|
|
33
15
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
break;
|
|
17
|
+
case 39:
|
|
18
|
+
if (focusId.value == 0) {
|
|
19
|
+
focusId.value = 1;
|
|
20
|
+
}
|
|
21
|
+
break;
|
|
22
|
+
case 10000:
|
|
23
|
+
case 27:
|
|
24
|
+
props.onAction("back");
|
|
25
|
+
break;
|
|
26
|
+
case 13:
|
|
27
|
+
props.onAction(focusId.value == 0 ? "ok" : "cancel");
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
const actionDefines = {
|
|
34
|
+
onKeyDown
|
|
35
|
+
}
|
|
36
|
+
|
|
38
37
|
</script>
|
|
39
38
|
|
|
40
39
|
<template>
|
|
41
|
-
<jsv-focus-block
|
|
42
|
-
autoFocus
|
|
43
|
-
:name="name"
|
|
44
|
-
:onAction="{
|
|
45
|
-
onKeyDown: onKeyDown,
|
|
46
|
-
}"
|
|
47
|
-
>
|
|
40
|
+
<jsv-focus-block autoFocus :name="props.name" :onAction="actionDefines">
|
|
48
41
|
<div :style="{ top: 200, left: 465 }">
|
|
49
42
|
<div class="background"></div>
|
|
50
43
|
<div class="message">是否退出</div>
|
|
@@ -76,6 +69,7 @@ export default {
|
|
|
76
69
|
text-align: center;
|
|
77
70
|
font-size: 30;
|
|
78
71
|
}
|
|
72
|
+
|
|
79
73
|
.background {
|
|
80
74
|
left: 0;
|
|
81
75
|
top: 0;
|
|
@@ -83,6 +77,7 @@ export default {
|
|
|
83
77
|
height: 200;
|
|
84
78
|
background-color: rgba(0, 0, 0, 0.7);
|
|
85
79
|
}
|
|
80
|
+
|
|
86
81
|
.message {
|
|
87
82
|
top: 20;
|
|
88
83
|
width: 350;
|
|
@@ -1,58 +1,54 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
this.onAction.register("onBlur", this.onBlur);
|
|
53
|
-
this.onAction.register("onClick", this.onClick);
|
|
54
|
-
},
|
|
55
|
-
};
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shallowRef, computed } from "vue"
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
style: Object,
|
|
5
|
+
itemClick: Function,
|
|
6
|
+
itemFocus: Function,
|
|
7
|
+
data: Object,
|
|
8
|
+
query: Object,
|
|
9
|
+
onAction: Object,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
let focused = shallowRef(false)
|
|
13
|
+
|
|
14
|
+
const foucsStyle = computed(() => {
|
|
15
|
+
return {
|
|
16
|
+
width: props.style.width,
|
|
17
|
+
height: props.style.height,
|
|
18
|
+
};
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const itemStyle = computed(() => {
|
|
22
|
+
return {
|
|
23
|
+
width: props.style.width - 10,
|
|
24
|
+
height: props.style.height - 10,
|
|
25
|
+
backgroundColor: props.style.backgroundColor,
|
|
26
|
+
color: props.style.color,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const onFocus = () => {
|
|
32
|
+
focused.value = true;
|
|
33
|
+
if (props.itemFocus) {
|
|
34
|
+
props.itemFocus(props.data);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const onBlur = () => {
|
|
39
|
+
focused.value = false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const onClick = () => {
|
|
43
|
+
if (props.itemClick) {
|
|
44
|
+
props?.itemClick(props.query.id, props.data);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
props.onAction.register("onFocus", onFocus);
|
|
49
|
+
props.onAction.register("onBlur", onBlur);
|
|
50
|
+
props.onAction.register("onClick", onClick);
|
|
51
|
+
|
|
56
52
|
</script>
|
|
57
53
|
|
|
58
54
|
<template>
|
|
@@ -70,6 +66,7 @@ export default {
|
|
|
70
66
|
left: -5;
|
|
71
67
|
background-color: #0000ff;
|
|
72
68
|
}
|
|
69
|
+
|
|
73
70
|
.item {
|
|
74
71
|
text-align: center;
|
|
75
72
|
font-size: 30;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script setup>
|
|
2
2
|
import { MetroWidget, VERTICAL } from "jsview";
|
|
3
3
|
import Item from "./Item.vue";
|
|
4
4
|
|
|
@@ -10,88 +10,59 @@ const measures = (item) => {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
name: String,
|
|
15
|
+
itemFocus: Function,
|
|
16
|
+
onEdge: Function,
|
|
17
|
+
initId: Number,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const width = 1280;
|
|
21
|
+
const height = 100;
|
|
22
|
+
const data = [
|
|
23
|
+
{
|
|
24
|
+
width: 200,
|
|
25
|
+
height: 50,
|
|
26
|
+
name: "功能实例",
|
|
27
|
+
focusable: true,
|
|
28
|
+
id: 0,
|
|
17
29
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
{
|
|
31
|
+
width: 200,
|
|
32
|
+
height: 50,
|
|
33
|
+
name: "MetroWidget",
|
|
34
|
+
focusable: true,
|
|
35
|
+
id: 1,
|
|
23
36
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
height: 50,
|
|
31
|
-
name: "功能实例",
|
|
32
|
-
focusable: true,
|
|
33
|
-
id: 0,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
width: 200,
|
|
37
|
-
height: 50,
|
|
38
|
-
name: "MetroWidget",
|
|
39
|
-
focusable: true,
|
|
40
|
-
id: 1,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
width: 200,
|
|
44
|
-
height: 50,
|
|
45
|
-
name: "首页/运营",
|
|
46
|
-
focusable: true,
|
|
47
|
-
id: 2,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
width: 200,
|
|
51
|
-
height: 50,
|
|
52
|
-
name: "游戏实例",
|
|
53
|
-
focusable: true,
|
|
54
|
-
id: 3,
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
const direction = VERTICAL;
|
|
58
|
-
return {
|
|
59
|
-
width,
|
|
60
|
-
height,
|
|
61
|
-
data,
|
|
62
|
-
direction,
|
|
63
|
-
measures,
|
|
64
|
-
};
|
|
37
|
+
{
|
|
38
|
+
width: 200,
|
|
39
|
+
height: 50,
|
|
40
|
+
name: "首页/运营",
|
|
41
|
+
focusable: true,
|
|
42
|
+
id: 2,
|
|
65
43
|
},
|
|
66
|
-
|
|
44
|
+
{
|
|
45
|
+
width: 200,
|
|
46
|
+
height: 50,
|
|
47
|
+
name: "游戏实例",
|
|
48
|
+
focusable: true,
|
|
49
|
+
id: 3,
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
const direction = VERTICAL;
|
|
53
|
+
|
|
67
54
|
</script>
|
|
68
55
|
|
|
69
56
|
<template>
|
|
70
|
-
<metro-widget
|
|
71
|
-
:
|
|
72
|
-
:width="width"
|
|
73
|
-
:height="height"
|
|
74
|
-
:direction="direction"
|
|
75
|
-
:data="data"
|
|
76
|
-
:measures="measures"
|
|
77
|
-
:padding="{ left: 10, top: 10, right: 10, bottom: 10 }"
|
|
78
|
-
:onEdge="onEdge"
|
|
79
|
-
:initFocusId="initId"
|
|
80
|
-
>
|
|
57
|
+
<metro-widget :name="props.name" :width="width" :height="height" :direction="direction" :data="data"
|
|
58
|
+
:measures="measures" :padding="{ left: 10, top: 10, right: 10, bottom: 10 }" :onEdge="props.onEdge" :initFocusId="props.initId">
|
|
81
59
|
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
82
|
-
<Item
|
|
83
|
-
:style="{
|
|
60
|
+
<Item :style="{
|
|
84
61
|
width: data.width,
|
|
85
62
|
height: data.height,
|
|
86
63
|
backgroundColor: '#00AA00',
|
|
87
64
|
color: '#FFFFFF',
|
|
88
|
-
}"
|
|
89
|
-
:data="data"
|
|
90
|
-
:query="query"
|
|
91
|
-
:onEdge="onEdge"
|
|
92
|
-
:onAction="onAction"
|
|
93
|
-
:itemFocus="itemFocus"
|
|
94
|
-
>
|
|
65
|
+
}" :data="data" :query="query" :onEdge="onEdge" :onAction="onAction" :itemFocus="props.itemFocus">
|
|
95
66
|
{{ data.name }}
|
|
96
67
|
</Item>
|
|
97
68
|
</template>
|
package/DemoHomepage/router.js
CHANGED
|
@@ -188,7 +188,7 @@ let routeList = [
|
|
|
188
188
|
component: () => import('jsview-vue-samples/FocusMoveStyle/App.vue'),
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
name: 'Mockjs',
|
|
191
|
+
name: 'Mockjs测试',
|
|
192
192
|
path: '/feature/MockjsDemo',
|
|
193
193
|
component: () => import('jsview-vue-samples/MockjsDemo/App.vue'),
|
|
194
194
|
},
|