@shijiu/jsview-vue-samples 2.0.1021 → 2.0.1073
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 +1 -1
- package/Basic/components/div/DivCssVar.vue +34 -16
- package/CommonUtils/ResourceData.js +11 -0
- package/CommonUtils/getSearchQuery.js +44 -0
- package/CssPreprocessor/Less/App.vue +1 -1
- package/CssPreprocessor/Less/components/less-group1/LessComments.vue +2 -2
- package/CssPreprocessor/Less/components/less-group1/LessConditionals.vue +2 -2
- package/CssPreprocessor/Less/components/less-group1/LessVariables.vue +6 -6
- package/CssPreprocessor/Less/components/less-group2/LessIteration.vue +1 -1
- package/CssPreprocessor/Less/components/less-group2/LessMethods.vue +2 -2
- package/CssPreprocessor/Less/components/less-group3/LessExtends.vue +2 -2
- package/CssPreprocessor/Less/components/less-group3/LessNesting.vue +4 -4
- package/CssPreprocessor/Less/components/less-group4/LessKeyframes.vue +1 -1
- package/CssPreprocessor/Less/components/less-group4/LessMaps.vue +1 -1
- package/CssPreprocessor/Less/components/less-group4/LessMixins.vue +1 -1
- package/CssPreprocessor/Less/components/less-group5/LessImporting.vue +7 -3
- package/CssPreprocessor/Less/components/less-group5/TextSettings.less +8 -1
- package/CssPreprocessor/Scss/App.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group1/ScssComments.vue +11 -10
- package/CssPreprocessor/Scss/components/scss-group1/ScssConditionals.vue +8 -6
- package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +2 -2
- package/CssPreprocessor/Scss/components/scss-group1/ScssVariables.vue +6 -6
- package/CssPreprocessor/Scss/components/scss-group2/ScssIteration.vue +2 -2
- package/CssPreprocessor/Scss/components/scss-group2/ScssMethods.vue +9 -9
- package/CssPreprocessor/Scss/components/scss-group3/ScssExtends.vue +2 -2
- package/CssPreprocessor/Scss/components/scss-group3/ScssNesting.vue +3 -3
- package/CssPreprocessor/Scss/components/scss-group4/ScssKeyframes.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group4/ScssMixins.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +7 -3
- package/CssPreprocessor/Scss/components/scss-group5/TextSettings.scss +8 -1
- package/CssPreprocessor/Stylus/App.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusComments.vue +2 -2
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusConditionals.vue +2 -2
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusVariables.vue +7 -7
- package/CssPreprocessor/Stylus/components/stylus-group2/StylusIteration.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group2/StylusMethods.vue +3 -3
- package/CssPreprocessor/Stylus/components/stylus-group3/StylusExtends.vue +2 -2
- package/CssPreprocessor/Stylus/components/stylus-group3/StylusNesting.vue +5 -5
- package/CssPreprocessor/Stylus/components/stylus-group4/StylusKeyframes.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group4/StylusMaps.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group4/StylusMixins.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group5/StylusImporting.vue +7 -3
- package/CssPreprocessor/Stylus/components/stylus-group5/TextSettings.styl +8 -1
- package/CssPreprocessor/utils/ContentBlock.vue +5 -3
- package/CssPreprocessor/utils/FontStyle.css +1 -1
- package/CssPreprocessor/utils/Panel.vue +1 -1
- package/CssPreprocessor/utils/TitleBar.vue +4 -2
- package/DemoHomepage/App.vue +22 -19
- package/DemoHomepage/router.js +9 -0
- package/FilterDemo/AnimatePic.vue +6 -1
- package/FocusMoveStyle/App.vue +37 -46
- package/FocusMoveStyle/Item.vue +7 -17
- package/FocusMoveStyle/assets/redCircle.png +0 -0
- package/GiftRain/App.vue +52 -27
- package/GiftRain/components/RedPacket.vue +17 -15
- package/JsvRadarChart/App.vue +99 -0
- package/JsvRadarChart/assets/Square.png +0 -0
- package/JsvRadarChart/assets/resultSquare.png +0 -0
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +78 -0
- package/MetroWidgetDemos/SkeletonDiagram/Item.vue +111 -0
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +237 -0
- package/MetroWidgetDemos/SkeletonDiagram/data.js +16 -0
- package/MetroWidgetDemos/itemSizeUpdate/App.vue +51 -0
- package/MetroWidgetDemos/itemSizeUpdate/backward/Backward.vue +107 -0
- package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +133 -0
- package/MetroWidgetDemos/itemSizeUpdate/center/Center.vue +106 -0
- package/MetroWidgetDemos/itemSizeUpdate/center/Item.vue +118 -0
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +105 -0
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +69 -0
- package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +89 -0
- package/MetroWidgetDemos/routeList.js +18 -5
- package/MetroWidgetDemos/slideSetting/App.vue +8 -8
- package/MockjsDemo/App.vue +54 -0
- package/MockjsDemo/KeyEventCatcher.vue +19 -0
- package/MockjsDemo/mock/index.js +12 -0
- package/NinePatchDemo/App.vue +2 -2
- package/NinePatchDemo/Item.vue +15 -5
- package/Preload/Item.vue +27 -10
- package/SprayView/App.vue +71 -63
- package/SprayView/assets/goldencoin1.png +0 -0
- package/SprayView/assets/goldencoin2.png +0 -0
- package/SprayView/assets/redpacket1.png +0 -0
- package/SprayView/assets/redpacket2.png +0 -0
- package/SprayView/assets/star1.png +0 -0
- package/SprayView/assets/star2.png +0 -0
- package/SprayView/assets/star3.png +0 -0
- package/SprayView/assets/star4.png +0 -0
- package/Swiper/App.vue +1 -1
- package/TextureAnimation/App2.vue +4 -2
- package/TouchSample/Item.vue +0 -1
- package/package.json +2 -1
- /package/{FocusMoveStyle/assets/focus.png → assets/focus1.png} +0 -0
package/GiftRain/App.vue
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
<div
|
|
4
4
|
:style="{ width: 1920, height: 1080, overflow: 'hidden', transform: 'scale3d(0.67,0.67,1)', left: -220 * 1.5 + 8, top: -170 - 8 }">
|
|
5
5
|
<JsvPreload :preloadList="preload_info"></JsvPreload>
|
|
6
|
-
<div
|
|
7
|
-
:style="{ backgroundImage: bg, width: 1920, height: 1080, overflow: 'hidden' }">
|
|
6
|
+
<div :style="{ backgroundImage: resourceMap.bg, width: 1920, height: 1080, overflow: 'hidden' }">
|
|
8
7
|
<Score :score="score"></Score>
|
|
9
8
|
<JsvActorMove key="JsvSpriteTranslate" :style="{
|
|
10
9
|
top: 476 * 1.5,
|
|
@@ -51,7 +50,7 @@
|
|
|
51
50
|
|
|
52
51
|
</div>
|
|
53
52
|
<!-- 音频 -->
|
|
54
|
-
<JsvSystemAudio key="AudioBg" :src="_AudioBgUrl" :loop="true" :onRef="onRef1" :onLoad="audioOnLoad" />
|
|
53
|
+
<JsvSystemAudio key="AudioBg" :src="resourceMap._AudioBgUrl" :loop="true" :onRef="onRef1" :onLoad="audioOnLoad" />
|
|
55
54
|
|
|
56
55
|
<JsvSystemAudio v-if="!_DisableEffectSound" :onRef="onRef2" :loop="true" />
|
|
57
56
|
|
|
@@ -61,43 +60,69 @@
|
|
|
61
60
|
</template>
|
|
62
61
|
<script setup>
|
|
63
62
|
/* eslint-disable */
|
|
64
|
-
import { JsvFocusBlock, JsvActorMove, JsvActorMoveControl, jJsvRuntimeBridge, JsvPreload, buildPreloadInfo,JsvSystemAudio} from "jsview";
|
|
65
|
-
import { shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
63
|
+
import { JsvFocusBlock, JsvActorMove, JsvActorMoveControl, jJsvRuntimeBridge, JsvPreload, buildPreloadInfo, JsvSystemAudio } from "jsview";
|
|
64
|
+
import { shallowRef, onMounted, onBeforeUnmount, provide } from "vue";
|
|
66
65
|
import { useRouter } from "vue-router";
|
|
67
66
|
import Score from "./components/Score.vue";
|
|
68
67
|
import RedPacket from "./components/RedPacket.vue";
|
|
69
68
|
import Sound from "./common/Sound.js"
|
|
69
|
+
import { getDataUrl } from "../CommonUtils/ResourceData"
|
|
70
70
|
//音频Sound
|
|
71
71
|
const MySound = new Sound()
|
|
72
|
+
//接收是否有DemoResourceBase,没有则正常走公共网络地址。
|
|
73
|
+
const DemoResourceBase = getDataUrl()
|
|
72
74
|
//预加载信息
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
const resourceMap = {
|
|
76
|
+
kimi_normal: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/kimi_normal.png',
|
|
77
|
+
kimi_smile: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/kimi_smile.png',
|
|
78
|
+
kimi_boom: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/kimi_boom.png',
|
|
79
|
+
red_packet: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/red.png',
|
|
80
|
+
bigRed_packet: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/bigred.png',
|
|
81
|
+
boom_image: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/boom.png',
|
|
82
|
+
bg: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/bg.jpg',
|
|
83
|
+
_ScoreBg: "http://oss.image.qcast.cn/demo_images/red_packet_rain/score_bg.png",
|
|
84
|
+
add1: 'http://oss.image.qcast.cn/demo_images/red_packet_rain/add1.png',
|
|
85
|
+
add5: "http://oss.image.qcast.cn/demo_images/red_packet_rain/add5.png",
|
|
86
|
+
min1: "http://oss.image.qcast.cn/demo_images/red_packet_rain/min1.png",
|
|
87
|
+
_AudioBgUrl: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewAudio/MiniGameBackgroundMusic-redpack.mp3"
|
|
88
|
+
}
|
|
89
|
+
if (DemoResourceBase) {
|
|
90
|
+
console.log('存在');
|
|
91
|
+
console.log(DemoResourceBase);
|
|
92
|
+
//正则进行替换
|
|
93
|
+
for (let i in resourceMap) {
|
|
94
|
+
//此正则规则是替换掉最后一个 / 前面的字符
|
|
95
|
+
resourceMap[i] = resourceMap[i].replace(/.*\/(.*)/, `${DemoResourceBase}/$1`);
|
|
96
|
+
}
|
|
97
|
+
//修改后暴露给子组件
|
|
98
|
+
provide("resourceMap", resourceMap)
|
|
99
|
+
} else {
|
|
100
|
+
//暴露给子组件
|
|
101
|
+
provide("resourceMap", resourceMap)
|
|
102
|
+
}
|
|
80
103
|
const preload_info = [
|
|
81
|
-
buildPreloadInfo(kimi_normal),
|
|
82
|
-
buildPreloadInfo(kimi_smile),
|
|
83
|
-
buildPreloadInfo(kimi_boom),
|
|
84
|
-
buildPreloadInfo(red_packet),
|
|
85
|
-
buildPreloadInfo(bigRed_packet),
|
|
86
|
-
buildPreloadInfo(boom_image),
|
|
87
|
-
buildPreloadInfo(bg)
|
|
104
|
+
buildPreloadInfo(resourceMap.kimi_normal),
|
|
105
|
+
buildPreloadInfo(resourceMap.kimi_smile),
|
|
106
|
+
buildPreloadInfo(resourceMap.kimi_boom),
|
|
107
|
+
buildPreloadInfo(resourceMap.red_packet),
|
|
108
|
+
buildPreloadInfo(resourceMap.bigRed_packet),
|
|
109
|
+
buildPreloadInfo(resourceMap.boom_image),
|
|
110
|
+
buildPreloadInfo(resourceMap.bg),
|
|
111
|
+
buildPreloadInfo(resourceMap.add1),
|
|
112
|
+
buildPreloadInfo(resourceMap.add5),
|
|
113
|
+
buildPreloadInfo(resourceMap.min1)
|
|
88
114
|
];
|
|
89
115
|
//定义不需要响应式的变量
|
|
90
116
|
let _CurrentRain = null;
|
|
91
117
|
//音频ref
|
|
92
118
|
let _Audio = null;
|
|
93
|
-
let _AudioBgUrl = "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewAudio/MiniGameBackgroundMusic-redpack.mp3";
|
|
94
119
|
//背景音频ref
|
|
95
120
|
let _BgAudio = null;
|
|
96
121
|
let _IsRunning = false;
|
|
97
122
|
let _DisableEffectSound = true;
|
|
98
123
|
let _TranslateControl = new JsvActorMoveControl()
|
|
99
124
|
//定义需要响应式的变量
|
|
100
|
-
let kimi = shallowRef(
|
|
125
|
+
let kimi = shallowRef(resourceMap.kimi_normal)
|
|
101
126
|
let score = shallowRef(0)
|
|
102
127
|
let min_score_image = shallowRef(null)
|
|
103
128
|
let add_score_image = shallowRef(null)
|
|
@@ -126,22 +151,22 @@ const _onImpactTracer = (rain) => {
|
|
|
126
151
|
switch (rain.type) {
|
|
127
152
|
case 0:
|
|
128
153
|
scoreAddAnim.value = "scoreUp 0.2s";
|
|
129
|
-
kimi.value =
|
|
130
|
-
add_score_image.value =
|
|
154
|
+
kimi.value = resourceMap.kimi_normal;
|
|
155
|
+
add_score_image.value = resourceMap.add1;
|
|
131
156
|
score.value += 1;
|
|
132
157
|
MySound.playGetSound()
|
|
133
158
|
break;
|
|
134
159
|
case 1:
|
|
135
160
|
scoreAddAnim.value = "scoreUp 0.2s";
|
|
136
|
-
kimi.value =
|
|
137
|
-
add_score_image.value =
|
|
161
|
+
kimi.value = resourceMap.kimi_smile;
|
|
162
|
+
add_score_image.value = resourceMap.add5;
|
|
138
163
|
MySound.playGetSound()
|
|
139
164
|
score.value += 5;
|
|
140
165
|
break;
|
|
141
166
|
case 2:
|
|
142
167
|
scoreMinAnim.value = "scoreUp 0.2s";
|
|
143
|
-
min_score_image.value =
|
|
144
|
-
kimi.value =
|
|
168
|
+
min_score_image.value = resourceMap.min1;
|
|
169
|
+
kimi.value = resourceMap.kimi_boom;
|
|
145
170
|
score.value -= 1;
|
|
146
171
|
MySound.playBoomSound()
|
|
147
172
|
if (score.value < 0) {
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div key="timer" :style="{
|
|
4
|
-
width: 140*1.5,
|
|
5
|
-
height: 140*1.5,
|
|
4
|
+
width: 140 * 1.5,
|
|
5
|
+
height: 140 * 1.5,
|
|
6
6
|
backgroundImage: _ScoreBg,
|
|
7
|
-
top: 40*1.5,
|
|
8
|
-
left: 40*1.5,
|
|
7
|
+
top: 40 * 1.5,
|
|
8
|
+
left: 40 * 1.5,
|
|
9
9
|
textAlign: 'center',
|
|
10
|
-
lineHeight: 140*1.5,
|
|
10
|
+
lineHeight: 140 * 1.5,
|
|
11
11
|
color: 'rgba(255,0,0,1.0)',
|
|
12
|
-
fontSize: 72*1.5
|
|
12
|
+
fontSize: 72 * 1.5
|
|
13
13
|
}">{{ timer }}</div>
|
|
14
14
|
<SpriteTranslate v-for="(item, index) in itemList" :MoneyBag="props.MoneyBag" :onImpactTracer="onImpactTracer"
|
|
15
15
|
:onDestory="_RemoveItem" :key="`spritetranslate${item.key}`" :item=item />
|
|
16
|
-
</div>
|
|
16
|
+
</div>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup>
|
|
20
|
-
import { shallowRef, defineProps, onMounted, onBeforeUnmount } from 'vue';
|
|
20
|
+
import { shallowRef, defineProps, onMounted, onBeforeUnmount, inject } from 'vue';
|
|
21
21
|
import SpriteTranslate from './SpriteTranslate.vue';
|
|
22
22
|
//定义props
|
|
23
23
|
const props = defineProps({
|
|
24
24
|
onImpactTracer: Function,
|
|
25
25
|
MoneyBag: Object,
|
|
26
|
-
_ScoreMinAnimationEnd:Function,
|
|
27
|
-
_ScoreAddAnimationEnd:Function
|
|
26
|
+
_ScoreMinAnimationEnd: Function,
|
|
27
|
+
_ScoreAddAnimationEnd: Function
|
|
28
28
|
})
|
|
29
|
+
//接收
|
|
30
|
+
const resourceMap = inject("resourceMap")
|
|
29
31
|
let _Index = 0;
|
|
30
32
|
// 随机生成列表
|
|
31
|
-
const _RedImage =
|
|
32
|
-
const _BigRedImage =
|
|
33
|
-
const _BoomImage =
|
|
34
|
-
const _ScoreBg =
|
|
35
|
-
let itemList =shallowRef([])
|
|
33
|
+
const _RedImage = resourceMap.red_packet;
|
|
34
|
+
const _BigRedImage = resourceMap.bigRed_packet;
|
|
35
|
+
const _BoomImage = resourceMap.boom_image;
|
|
36
|
+
const _ScoreBg = resourceMap._ScoreBg;
|
|
37
|
+
let itemList = shallowRef([])
|
|
36
38
|
let timer = shallowRef(60)
|
|
37
39
|
const onImpactTracer = props.onImpactTracer;
|
|
38
40
|
let _TimerOutId = null;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ZhengYi
|
|
3
|
+
* @Date: 2023-04-26
|
|
4
|
+
* @LastEditors: ZhengYi
|
|
5
|
+
* @LastEditTime: 2023-04-26
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<jsv-focus-block autoFocus :onAction="actionDefines">
|
|
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>
|
|
21
|
+
<JsvRadarChart :data="data" :backgroundUrl="bgImageUrl" :foregroundUrl="resultSquare" :style="style"
|
|
22
|
+
:fontSize="fontSize" :extendOffset="70" :fontColor="'#ff3212'" :radius="200" />
|
|
23
|
+
<JsvRadarChart :data="data2" :backgroundUrl="bgImageUrl" :foregroundUrl="resultSquare" :style="style2"
|
|
24
|
+
:fontSize="fontSize" :extendOffset="50" :fontColor="'#FFF231'" :radius="200" />
|
|
25
|
+
</jsv-focus-block>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { JsvRadarChart } from "jsview";
|
|
30
|
+
import resultSquare from "./assets/resultSquare.png"
|
|
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();
|
|
36
|
+
const data = ref([
|
|
37
|
+
{ title: '语文', value: 70 },
|
|
38
|
+
{ title: '数学', value: 98 },
|
|
39
|
+
{ title: '英语', value: 40 },
|
|
40
|
+
{ title: '化学', value: 80 },
|
|
41
|
+
{ title: '生物', value: 92 },
|
|
42
|
+
{ title: '物理', value: 88 },
|
|
43
|
+
])
|
|
44
|
+
const data2 = ref([
|
|
45
|
+
{ title: '语文', value: 30 },
|
|
46
|
+
{ title: '数学', value: 40 },
|
|
47
|
+
{ title: '英语', value: 50 },
|
|
48
|
+
{ title: '化学', value: 40 },
|
|
49
|
+
{ title: '生物', value: 44 },
|
|
50
|
+
])
|
|
51
|
+
|
|
52
|
+
const style = {
|
|
53
|
+
top: 400,
|
|
54
|
+
left: 300
|
|
55
|
+
}
|
|
56
|
+
const style2 = {
|
|
57
|
+
top: 400,
|
|
58
|
+
left: 950
|
|
59
|
+
}
|
|
60
|
+
const fontSize = 30;
|
|
61
|
+
|
|
62
|
+
const onKeyDown = (ev) => {
|
|
63
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
64
|
+
router.go(-1)
|
|
65
|
+
} else if (ev.keyCode == 39) {
|
|
66
|
+
data.value.forEach((item, index) => {
|
|
67
|
+
item.value += Math.random() * 10
|
|
68
|
+
if (item.value >= 100) {
|
|
69
|
+
item.value = 100
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
data2.value.forEach((item, index) => {
|
|
73
|
+
item.value += Math.random() * 10
|
|
74
|
+
if (item.value >= 100) {
|
|
75
|
+
item.value = 100
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
} else if (ev.keyCode == 37) {
|
|
79
|
+
data.value.forEach((item, index) => {
|
|
80
|
+
item.value -= Math.random() * 10
|
|
81
|
+
if (item.value <= 10) {
|
|
82
|
+
item.value == 8
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
data2.value.forEach((item, index) => {
|
|
86
|
+
item.value -= Math.random() * 10
|
|
87
|
+
if (item.value <= 10) {
|
|
88
|
+
item.value == 8
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const actionDefines = {
|
|
94
|
+
onKeyDown
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<style scoped></style>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import {
|
|
3
|
+
MetroWidget,
|
|
4
|
+
VERTICAL,
|
|
5
|
+
useFocusHub,
|
|
6
|
+
JsvPosterImage,
|
|
7
|
+
JsvPosterDiv,
|
|
8
|
+
} from "jsview";
|
|
9
|
+
import Item from "./Item.vue";
|
|
10
|
+
import { ref, onMounted } from "vue";
|
|
11
|
+
import { useRouter } from "vue-router";
|
|
12
|
+
import data from "./data.js";
|
|
13
|
+
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
const focusHub = useFocusHub();
|
|
16
|
+
|
|
17
|
+
const measures = (item) => {
|
|
18
|
+
return {
|
|
19
|
+
width: item.width,
|
|
20
|
+
height: item.height,
|
|
21
|
+
marginRight: 10,
|
|
22
|
+
marginTop: 10,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const onKeyDown = (ev) => {
|
|
27
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
28
|
+
router.go(-1);
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const provideData = () => {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
onMounted(() => {
|
|
38
|
+
focusHub.setFocus("myFocusWidget");
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<jsv-focus-block
|
|
44
|
+
ref="focusNode"
|
|
45
|
+
:style="{
|
|
46
|
+
width: 1920,
|
|
47
|
+
height: 1080,
|
|
48
|
+
backgroundColor: '#007788',
|
|
49
|
+
}"
|
|
50
|
+
:onKeyDown="onKeyDown"
|
|
51
|
+
>
|
|
52
|
+
<metro-widget
|
|
53
|
+
name="myFocusWidget"
|
|
54
|
+
:top="50"
|
|
55
|
+
:left="50"
|
|
56
|
+
:width="1000"
|
|
57
|
+
:height="550"
|
|
58
|
+
:direction="VERTICAL"
|
|
59
|
+
:provideData="provideData"
|
|
60
|
+
:measures="measures"
|
|
61
|
+
:padding="{ left: 50, right: 50, top: 50, height: 50 }"
|
|
62
|
+
:enableItemRenderBreak="true"
|
|
63
|
+
:placeHolderSetting="{
|
|
64
|
+
backgroundColor: 'rgba(78,105,127, 0.8)',
|
|
65
|
+
gap: 10,
|
|
66
|
+
}"
|
|
67
|
+
>
|
|
68
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
69
|
+
<item
|
|
70
|
+
:data="data"
|
|
71
|
+
:query="query"
|
|
72
|
+
:onEdge="onEdge"
|
|
73
|
+
:onAction="onAction"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
</metro-widget>
|
|
77
|
+
</jsv-focus-block>
|
|
78
|
+
</template>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-02-06 10:19:42
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
import { JsvPosterImage, JsvPosterDiv } from "jsview";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
data: Object,
|
|
12
|
+
query: Object,
|
|
13
|
+
onEdge: Function,
|
|
14
|
+
onAction: Object,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
let focused = ref(false);
|
|
18
|
+
|
|
19
|
+
const onFocus = () => {
|
|
20
|
+
focused.value = true;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const onBlur = () => {
|
|
24
|
+
focused.value = false;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const onClicked = () => {
|
|
28
|
+
console.log(`item ${props.query.id} clicked`);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
props.onAction.register("onFocus", onFocus);
|
|
32
|
+
props.onAction.register("onBlur", onBlur);
|
|
33
|
+
props.onAction.register("onClick", onClicked);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div
|
|
38
|
+
:style="{
|
|
39
|
+
width: data.width,
|
|
40
|
+
height: data.height,
|
|
41
|
+
transition: 'transform 0.25s linear',
|
|
42
|
+
transform: focused ? 'scale3d(1.1, 1.1, 1)' : '',
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
v-if="focused"
|
|
47
|
+
:style="{
|
|
48
|
+
left: -10,
|
|
49
|
+
top: -10,
|
|
50
|
+
width: props.data.width + 20,
|
|
51
|
+
height: props.data.height + 20,
|
|
52
|
+
backgroundColor: '#770088',
|
|
53
|
+
}"
|
|
54
|
+
>
|
|
55
|
+
</div>
|
|
56
|
+
<div v-if="query.index % 2 == 0">
|
|
57
|
+
<jsv-poster-image
|
|
58
|
+
:style="{
|
|
59
|
+
width: data.width,
|
|
60
|
+
height: data.height,
|
|
61
|
+
}"
|
|
62
|
+
:src="data.url"
|
|
63
|
+
>
|
|
64
|
+
<div
|
|
65
|
+
:style="{
|
|
66
|
+
width: data.width,
|
|
67
|
+
height: data.height,
|
|
68
|
+
backgroundColor: '#ff0000',
|
|
69
|
+
}"
|
|
70
|
+
/>
|
|
71
|
+
</jsv-poster-image>
|
|
72
|
+
<div
|
|
73
|
+
:style="{
|
|
74
|
+
width: 40,
|
|
75
|
+
height: 30,
|
|
76
|
+
backgroundColor: '#007788',
|
|
77
|
+
fontSize: 20,
|
|
78
|
+
}"
|
|
79
|
+
>
|
|
80
|
+
{{ "img" }}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<div v-else>
|
|
84
|
+
<jsv-poster-div
|
|
85
|
+
:style="{
|
|
86
|
+
width: data.width,
|
|
87
|
+
height: data.height,
|
|
88
|
+
backgroundImage: `url(${data.url})`,
|
|
89
|
+
}"
|
|
90
|
+
>
|
|
91
|
+
<div
|
|
92
|
+
:style="{
|
|
93
|
+
width: data.width,
|
|
94
|
+
height: data.height,
|
|
95
|
+
backgroundColor: '#ff0000',
|
|
96
|
+
}"
|
|
97
|
+
/>
|
|
98
|
+
</jsv-poster-div>
|
|
99
|
+
<div
|
|
100
|
+
:style="{
|
|
101
|
+
width: 40,
|
|
102
|
+
height: 30,
|
|
103
|
+
backgroundColor: '#007788',
|
|
104
|
+
fontSize: 20,
|
|
105
|
+
}"
|
|
106
|
+
>
|
|
107
|
+
{{ "div" }}
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|