@shijiu/jsview-vue 0.9.766 → 0.9.804
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/target_core_revision.js +4 -4
- package/package.json +1 -1
- package/samples/Basic/components/anim/AnimTransition.vue +4 -4
- package/samples/DemoHomepage/App.vue +30 -6
- package/samples/DemoHomepage/components/TabFrame.vue +7 -0
- package/samples/DemoHomepage/router.js +21 -18
- package/samples/DemoHomepage/views/Homepage.vue +5 -1
- package/samples/FilterDemo/VideoLayer.vue +2 -2
- package/samples/FocusBlockDemos/AutoFocus/App.vue +56 -0
- package/samples/FocusBlockDemos/AutoFocus/BaseBlock.vue +82 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogBlock.vue +89 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogContorls.js +47 -0
- package/samples/FocusBlockDemos/AutoFocus/FocusNamesDefine.js +9 -0
- package/samples/FocusBlockDemos/AutoFocus/PlaneBlock.vue +71 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/App.vue +84 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/BaseBlock.vue +77 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/DownPlaneBlock.vue +83 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/FocusNamesDefine.js +12 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/UpPlaneBlock.vue +83 -0
- package/samples/GiftRain/App.vue +248 -0
- package/samples/GiftRain/audio/boom.mp3 +0 -0
- package/samples/GiftRain/audio/get.mp3 +0 -0
- package/samples/GiftRain/common/Sound.js +48 -0
- package/samples/GiftRain/components/RedPacket.vue +161 -0
- package/samples/GiftRain/components/Score.vue +55 -0
- package/samples/GiftRain/components/SpriteTranslate.vue +72 -0
- package/samples/GridDemo/Item.vue +1 -0
- package/samples/ImpactStop/App.vue +2 -2
- package/samples/Marquee/App.vue +34 -3
- package/samples/MetroWidgetDemos/PingPong/App.vue +22 -11
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
- package/samples/MetroWidgetDemos/{Item.vue → PingPong/Item.vue} +1 -3
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +3 -3
- package/samples/MetroWidgetDemos/{WidgetItem.vue → PingPong/WidgetItem.vue} +6 -1
- package/samples/MetroWidgetDemos/basic/App.vue +162 -0
- package/samples/MetroWidgetDemos/basic/Item.vue +43 -0
- package/samples/MetroWidgetDemos/direction/App.vue +158 -0
- package/samples/MetroWidgetDemos/direction/Item.vue +45 -0
- package/samples/MetroWidgetDemos/focusableItemBasic/App.vue +67 -0
- package/samples/MetroWidgetDemos/{Advanced → focusableItemBasic}/ButtonItem.vue +16 -20
- package/samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue +74 -0
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/Item.vue +12 -30
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/WidgetItem.vue +10 -9
- package/samples/MetroWidgetDemos/focusableItemMix/App.vue +88 -0
- package/samples/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +86 -0
- package/samples/MetroWidgetDemos/focusableItemMix/Item.vue +43 -0
- package/samples/MetroWidgetDemos/index.js +6 -0
- package/samples/MetroWidgetDemos/layoutType/App.vue +180 -0
- package/samples/MetroWidgetDemos/layoutType/Item.vue +45 -0
- package/samples/MetroWidgetDemos/padding/App.vue +222 -0
- package/samples/MetroWidgetDemos/padding/Item.vue +64 -0
- package/samples/MetroWidgetDemos/routeList.js +64 -0
- package/samples/MetroWidgetDemos/slideSetting/App.vue +225 -0
- package/samples/MetroWidgetDemos/slideSetting/Item.vue +45 -0
- package/samples/NinePatchDemo/App.vue +78 -122
- package/samples/NinePatchDemo/Item.vue +28 -26
- package/samples/Swiper/App.vue +148 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +15 -12
- package/utils/JsViewEngineWidget/TemplateParser.js +6 -1
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +17 -1
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +15 -38
- package/utils/JsViewPlugin/JsvAudio/version.js +10 -10
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvTextTools.js +26 -3
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +1 -1
- package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
- package/utils/JsViewVueWidget/JsvMarquee.vue +81 -20
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvPosterImage.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +43 -9
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +115 -79
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -2
- package/utils/JsViewVueWidget/JsvTextBox.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +1 -1
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
- package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
- package/samples/MetroWidgetDemos/data.js +0 -205
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +0 -35
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div key="timer" :style="{
|
|
4
|
+
width: 140*1.5,
|
|
5
|
+
height: 140*1.5,
|
|
6
|
+
backgroundImage: _ScoreBg,
|
|
7
|
+
top: 40*1.5,
|
|
8
|
+
left: 40*1.5,
|
|
9
|
+
textAlign: 'center',
|
|
10
|
+
lineHeight: 140*1.5,
|
|
11
|
+
color: 'rgba(255,0,0,1.0)',
|
|
12
|
+
fontSize: 72*1.5
|
|
13
|
+
}">{{ timer }}</div>
|
|
14
|
+
<SpriteTranslate v-for="(item, index) in itemList" :MoneyBag="props.MoneyBag" :onImpactTracer="onImpactTracer"
|
|
15
|
+
:onDestory="_RemoveItem" :key="`spritetranslate${item.key}`" :item=item />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup>
|
|
20
|
+
import { shallowRef, defineProps, onMounted, onBeforeUnmount } from 'vue';
|
|
21
|
+
import SpriteTranslate from './SpriteTranslate.vue';
|
|
22
|
+
//定义props
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
onImpactTracer: Function,
|
|
25
|
+
MoneyBag: Object,
|
|
26
|
+
_ScoreMinAnimationEnd:Function,
|
|
27
|
+
_ScoreAddAnimationEnd:Function
|
|
28
|
+
})
|
|
29
|
+
let _Index = 0;
|
|
30
|
+
// 随机生成列表
|
|
31
|
+
const _RedImage = 'http://oss.image.qcast.cn/demo_images/red_packet_rain/red.png';
|
|
32
|
+
const _BigRedImage = 'http://oss.image.qcast.cn/demo_images/red_packet_rain/bigred.png';
|
|
33
|
+
const _BoomImage = 'http://oss.image.qcast.cn/demo_images/red_packet_rain/boom.png';
|
|
34
|
+
const _ScoreBg = "http://oss.image.qcast.cn/demo_images/red_packet_rain/score_bg.png";
|
|
35
|
+
let itemList =shallowRef([])
|
|
36
|
+
let timer = shallowRef(60)
|
|
37
|
+
const onImpactTracer = props.onImpactTracer;
|
|
38
|
+
let _TimerOutId = null;
|
|
39
|
+
let _GameTimerID = null;
|
|
40
|
+
let _IsRunning = shallowRef(false);
|
|
41
|
+
|
|
42
|
+
//定义随机加入的item
|
|
43
|
+
const addRandomItemList = () => {
|
|
44
|
+
const total_num = 1;
|
|
45
|
+
let ret_obj = "";
|
|
46
|
+
for (let i = 0; i < total_num; i++) {
|
|
47
|
+
const random_index = Math.floor(Math.random() * 3);
|
|
48
|
+
const duration = 2 + Math.floor(Math.random() * 2);
|
|
49
|
+
const index = ++_Index;
|
|
50
|
+
const left = 300 * 1.5 + Math.floor(Math.random() * (1280 - 500) * 1.5);
|
|
51
|
+
const top = -20 * 1.5;
|
|
52
|
+
|
|
53
|
+
switch (random_index) {
|
|
54
|
+
case 0:
|
|
55
|
+
ret_obj = {
|
|
56
|
+
key: index.toString(), type: 0, src: _RedImage, left, top, width: 87, height: 118, duration,
|
|
57
|
+
};
|
|
58
|
+
break;
|
|
59
|
+
case 1:
|
|
60
|
+
ret_obj = {
|
|
61
|
+
key: index.toString(), type: 1, src: _BigRedImage, left, top, width: 210, height: 114, duration,
|
|
62
|
+
};
|
|
63
|
+
break;
|
|
64
|
+
case 2:
|
|
65
|
+
ret_obj = {
|
|
66
|
+
key: index.toString(), type: 2, src: _BoomImage, left, top, width: 100, height: 116, duration
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log("initRandomItemList ret_obj:", ret_obj);
|
|
74
|
+
itemList.value.push(ret_obj);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// addRandomItemList();
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const startTimer = () => {
|
|
82
|
+
_TimerOutId = setInterval(() => {
|
|
83
|
+
console.log('timmmm', timer.value);
|
|
84
|
+
timer.value = timer.value - 1;
|
|
85
|
+
if (timer.value === 0) {
|
|
86
|
+
stopGame();
|
|
87
|
+
itemList.value = []
|
|
88
|
+
}
|
|
89
|
+
}, 1000);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const startGame = () => {
|
|
93
|
+
console.log("startGame ");
|
|
94
|
+
_IsRunning.value = true;
|
|
95
|
+
_Refresh();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const stopGame = () => {
|
|
99
|
+
console.log("stopGame ");
|
|
100
|
+
_IsRunning.value = false;
|
|
101
|
+
if (_TimerOutId !== null) {
|
|
102
|
+
clearInterval(_TimerOutId);
|
|
103
|
+
_TimerOutId = null;
|
|
104
|
+
}
|
|
105
|
+
//停止游戏时动画也应该停止
|
|
106
|
+
props._ScoreMinAnimationEnd()
|
|
107
|
+
props._ScoreAddAnimationEnd()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const _RemoveItem = (key) => {
|
|
111
|
+
console.log("_RemoveItem in itemList.length:", itemList.value.length);
|
|
112
|
+
for (let i = 0; i < itemList.value.length; i++) {
|
|
113
|
+
if (itemList.value[i].key === key) {
|
|
114
|
+
const item = itemList.value[i];
|
|
115
|
+
if (item.sensor) {
|
|
116
|
+
item.sensor.Recycle();
|
|
117
|
+
}
|
|
118
|
+
console.log("_RemoveItem key:", itemList.value[i].key);
|
|
119
|
+
itemList.value.splice(i, 1);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
console.log("_RemoveItem out itemList.length:", itemList.value.length);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const _Refresh = () => {
|
|
127
|
+
if (_IsRunning.value === false) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const delay = 500;// Math.floor(Math.random()*600);
|
|
131
|
+
_GameTimerID = setTimeout(() => {
|
|
132
|
+
if (_IsRunning.value === true) {
|
|
133
|
+
addRandomItemList();
|
|
134
|
+
_Refresh();
|
|
135
|
+
}
|
|
136
|
+
}, delay);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
onMounted(() => {
|
|
141
|
+
console.log("render itemList.length:", itemList.value.length);
|
|
142
|
+
startGame();
|
|
143
|
+
startTimer();
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
onBeforeUnmount(() => {
|
|
147
|
+
if (_GameTimerID !== null) {
|
|
148
|
+
clearInterval(_GameTimerID);
|
|
149
|
+
_GameTimerID = null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (_TimerOutId !== null) {
|
|
153
|
+
clearInterval(_TimerOutId);
|
|
154
|
+
_TimerOutId = null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
stopGame();
|
|
158
|
+
})
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<style scoped></style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div key="progress-container" :style="{
|
|
4
|
+
width: 40 * 1.5,
|
|
5
|
+
height: 400 * 1.5,
|
|
6
|
+
top: 200 * 1.5,
|
|
7
|
+
left: (40 + 70 - 20) * 1.5,
|
|
8
|
+
backgroundColor: 'rgba(255,255,255,0.2)'
|
|
9
|
+
}">
|
|
10
|
+
<div key="progress" :style="{
|
|
11
|
+
top: process_top * 1.5,
|
|
12
|
+
width: 40 * 1.5,
|
|
13
|
+
height: score_height * 1.5,
|
|
14
|
+
backgroundColor: '#ffd050'
|
|
15
|
+
}">
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div key="score" :style="{
|
|
19
|
+
width: 140 * 1.5,
|
|
20
|
+
height: 40 * 1.5,
|
|
21
|
+
color: '#ffd050',
|
|
22
|
+
fontSize: 24 * 1.5,
|
|
23
|
+
top: 620 * 1.5,
|
|
24
|
+
left: 40 * 1.5,
|
|
25
|
+
lineHeight: 40 * 1.5,
|
|
26
|
+
textOverflow: 'clip',
|
|
27
|
+
textAlign: 'center'
|
|
28
|
+
}">{{ `分数:${score}` }}</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup type="text/javascript">
|
|
33
|
+
/* eslint-disable */
|
|
34
|
+
import { shallowRef, defineProps, watch} from 'vue';
|
|
35
|
+
//定义props
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
score: Number
|
|
38
|
+
})
|
|
39
|
+
//定义得分
|
|
40
|
+
let score_height = shallowRef(0);
|
|
41
|
+
// let score = toRef(props, 'score');
|
|
42
|
+
let process_top = shallowRef(0)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
//监听分数
|
|
46
|
+
watch(props, (n, o) => {
|
|
47
|
+
score_height.value = (props.score * 400 / 200)
|
|
48
|
+
if (score_height.value > 400) {
|
|
49
|
+
score_height.value = 400;
|
|
50
|
+
}
|
|
51
|
+
process_top.value = 400 - score_height.value;
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style scoped></style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<JsvActorMove :key="`translate${item.key}`" ref="translateF"
|
|
3
|
+
:style="{ left: item.left, top: item.top, width: item.width, height: item.height }" :control="_Control">
|
|
4
|
+
<div :key="`bg${item.key}`" ref="translate"
|
|
5
|
+
:style="{ backgroundImage: `url(${item.src})`, left: 0, top: 0, width: item.width, height: item.height }" />
|
|
6
|
+
</JsvActorMove>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import { shallowRef, defineProps, onMounted, onBeforeMount } from 'vue';
|
|
11
|
+
import { JsvActorMove, JsvActorMoveControl, createImpactTracer, createImpactCallback, createImpactAutoFroze } from 'jsview'
|
|
12
|
+
//定义子ref
|
|
13
|
+
let translate = shallowRef(null)
|
|
14
|
+
//定义父ref
|
|
15
|
+
let translateF=shallowRef(null)
|
|
16
|
+
//定义props
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
onDestory: Function,
|
|
19
|
+
item: Object,
|
|
20
|
+
onImpactTracer: Function,
|
|
21
|
+
MoneyBag: Object
|
|
22
|
+
})
|
|
23
|
+
const control = new JsvActorMoveControl();
|
|
24
|
+
const _Control = control;
|
|
25
|
+
const item = props.item;
|
|
26
|
+
//销毁方法
|
|
27
|
+
const _onDestroy = () => {
|
|
28
|
+
if (props.onDestory) {
|
|
29
|
+
props.onDestory(props.item.key);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let sensor = null;
|
|
34
|
+
|
|
35
|
+
const _InitItemEle = (item, ele) => {
|
|
36
|
+
if (ele && !item.ele) {
|
|
37
|
+
item.ele = ele;
|
|
38
|
+
if (props.MoneyBag) {
|
|
39
|
+
const giftrain_sensor = createImpactTracer(props.MoneyBag, ele, createImpactCallback(
|
|
40
|
+
() => {
|
|
41
|
+
props.onImpactTracer(item);
|
|
42
|
+
_onDestroy();
|
|
43
|
+
},
|
|
44
|
+
), //碰撞即停
|
|
45
|
+
createImpactAutoFroze(
|
|
46
|
+
[props.MoneyBag,translateF.value.mainDiv],
|
|
47
|
+
null
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
sensor = giftrain_sensor;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
//挂载时初始化
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
_InitItemEle(item, translate.value)
|
|
59
|
+
_Control.moveToY(720 * 1.5 + 30, 720 * 1.5 / item.duration, () => {
|
|
60
|
+
_onDestroy();
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
//卸载之前释放碰撞监听者
|
|
64
|
+
onBeforeMount(()=>{
|
|
65
|
+
if(sensor!=null){
|
|
66
|
+
sensor.Recycle()
|
|
67
|
+
sensor=null
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style lang="scss" scoped></style>
|
|
@@ -362,7 +362,7 @@ onBeforeUnmount(() => {
|
|
|
362
362
|
class="text"
|
|
363
363
|
:style="{ top: 528, left: 40, width: 405, height: 40 }"
|
|
364
364
|
>
|
|
365
|
-
|
|
365
|
+
{{ "JSV下,立刻起跳会精确到边缘" }}
|
|
366
366
|
</div>
|
|
367
367
|
|
|
368
368
|
<div
|
|
@@ -370,7 +370,7 @@ onBeforeUnmount(() => {
|
|
|
370
370
|
class="text"
|
|
371
371
|
:style="{ top: 625, left: 370, width: 540, height: 40 }"
|
|
372
372
|
>
|
|
373
|
-
|
|
373
|
+
{{ "左右键调整跳跃起点,按OK键进行跳跃" }}
|
|
374
374
|
</div>
|
|
375
375
|
<div
|
|
376
376
|
key="DirectText"
|
package/samples/Marquee/App.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-01-18 18:24:18
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: Please set LastEditors
|
|
5
|
+
* @LastEditTime: 2023-03-09 13:43:43
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
@@ -168,7 +168,6 @@ onMounted(() => {
|
|
|
168
168
|
lineHeight: 70,
|
|
169
169
|
fontSize: 50,
|
|
170
170
|
color: '#000000',
|
|
171
|
-
direction: 'rtl',
|
|
172
171
|
}"
|
|
173
172
|
text="انجليزي"
|
|
174
173
|
:slideSpeed="slideSpeed"
|
|
@@ -243,5 +242,37 @@ onMounted(() => {
|
|
|
243
242
|
超长rtl文字
|
|
244
243
|
</div>
|
|
245
244
|
</div>
|
|
245
|
+
<div
|
|
246
|
+
:style="{
|
|
247
|
+
left: 50,
|
|
248
|
+
top: 610,
|
|
249
|
+
width: width,
|
|
250
|
+
height: height,
|
|
251
|
+
backgroundColor: '#FFFFFF',
|
|
252
|
+
}"
|
|
253
|
+
>
|
|
254
|
+
<jsv-marquee
|
|
255
|
+
:style="{
|
|
256
|
+
width,
|
|
257
|
+
height,
|
|
258
|
+
lineHeight: 70,
|
|
259
|
+
fontSize: 50,
|
|
260
|
+
color: '#000000',
|
|
261
|
+
}"
|
|
262
|
+
text="测试文字"
|
|
263
|
+
:forceSlide="true"
|
|
264
|
+
:slideSpeed="slideSpeed"
|
|
265
|
+
slideDirection="ets"
|
|
266
|
+
/>
|
|
267
|
+
<div :style="{
|
|
268
|
+
left: width + 20,
|
|
269
|
+
height: height,
|
|
270
|
+
color: '#ffffff',
|
|
271
|
+
fontSize: 50,
|
|
272
|
+
lineHeight: 50,
|
|
273
|
+
}">
|
|
274
|
+
反向滚动示例
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
246
277
|
</jsv-focus-block>
|
|
247
278
|
</template>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-12-21 15:36:29
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: Please set LastEditors
|
|
5
|
+
* @LastEditTime: 2023-03-09 16:28:50
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
@@ -10,12 +10,18 @@ import ViewSwiper from "./ViewSwiper.vue";
|
|
|
10
10
|
import AppTab from "./AppTab.vue";
|
|
11
11
|
import { reactive } from "vue";
|
|
12
12
|
import { EdgeDirection } from "jsview";
|
|
13
|
-
import { advanceMetroWidget, randomColor } from "../data.js";
|
|
14
13
|
|
|
15
14
|
const pageList = [];
|
|
16
15
|
const tabData = [];
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
const randomColor = () => {
|
|
18
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
19
|
+
return (
|
|
20
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < 10; ++i) {
|
|
19
25
|
tabData.push({
|
|
20
26
|
width: 100,
|
|
21
27
|
height: 50,
|
|
@@ -23,15 +29,20 @@ for (let i = 0; i < 5; i++) {
|
|
|
23
29
|
content: "Tab_" + i,
|
|
24
30
|
color: randomColor(),
|
|
25
31
|
});
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
const pageData = [];
|
|
33
|
+
for (let j = 0; j < 10; ++j) {
|
|
34
|
+
pageData.push({
|
|
35
|
+
width: 500,
|
|
36
|
+
height: 170,
|
|
37
|
+
name: "testPage_" + i + "-" + "widget_" + j,
|
|
38
|
+
marginBottom: 10,
|
|
39
|
+
index: j,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
31
42
|
pageList.push({
|
|
32
43
|
width: 600,
|
|
33
44
|
height: 600,
|
|
34
|
-
data:
|
|
45
|
+
data: pageData,
|
|
35
46
|
name: "testPage-" + i,
|
|
36
47
|
});
|
|
37
48
|
}
|
|
@@ -112,7 +123,7 @@ export default {
|
|
|
112
123
|
<app-tab
|
|
113
124
|
:data="tabData"
|
|
114
125
|
:name="appTabName"
|
|
115
|
-
:layout="{ width:
|
|
126
|
+
:layout="{ width: 600, height: 100 }"
|
|
116
127
|
:onEdge="$_app_tabOnEdge"
|
|
117
128
|
:style="{
|
|
118
129
|
top: 15,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-07-12 10:45:38
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: Please set LastEditors
|
|
5
|
+
* @LastEditTime: 2023-03-09 16:27:44
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
9
|
import { VERTICAL, MetroWidget } from "jsview";
|
|
10
|
-
import WidgetItem from "
|
|
10
|
+
import WidgetItem from "./WidgetItem.vue";
|
|
11
11
|
import { ref, shallowRef, watch, onBeforeUnmount } from "vue";
|
|
12
12
|
|
|
13
13
|
const props = defineProps({
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-07-12 10:30:33
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: Please set LastEditors
|
|
5
|
+
* @LastEditTime: 2023-03-09 16:00:38
|
|
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
|
|
11
|
+
import { reactive } from "vue";
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
components: {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-09 16:27:38
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
1
6
|
|
|
2
7
|
<script setup>
|
|
3
8
|
import { HORIZONTAL, MetroWidget, useFocusHub } from "jsview";
|
|
@@ -43,7 +48,7 @@ const onFocus = (rect) => {
|
|
|
43
48
|
};
|
|
44
49
|
const onBlur = () => {
|
|
45
50
|
//onBlur时需要返还焦点给父MetroWidget
|
|
46
|
-
|
|
51
|
+
focusHub.returnFocusToParent();
|
|
47
52
|
};
|
|
48
53
|
|
|
49
54
|
props.onAction.register("onFocus", onFocus);
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { MetroWidget, HORIZONTAL, useFocusHub } from "jsview";
|
|
8
|
+
import Item from "./Item.vue";
|
|
9
|
+
import { onMounted } from "vue";
|
|
10
|
+
|
|
11
|
+
const TAG = "MetroWidgetDemo";
|
|
12
|
+
|
|
13
|
+
const focusHub = useFocusHub();
|
|
14
|
+
|
|
15
|
+
const randomColor = () => {
|
|
16
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
17
|
+
return (
|
|
18
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const provideData = () => {
|
|
23
|
+
const data = [
|
|
24
|
+
{
|
|
25
|
+
width: 90,
|
|
26
|
+
height: 90,
|
|
27
|
+
marginRight: 10,
|
|
28
|
+
marginBottom: 10,
|
|
29
|
+
color: randomColor(),
|
|
30
|
+
content: 0,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
width: 90,
|
|
34
|
+
height: 90,
|
|
35
|
+
marginRight: 10,
|
|
36
|
+
marginBottom: 10,
|
|
37
|
+
color: randomColor(),
|
|
38
|
+
content: 1,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
width: 90,
|
|
42
|
+
height: 90,
|
|
43
|
+
marginRight: 10,
|
|
44
|
+
marginBottom: 10,
|
|
45
|
+
color: randomColor(),
|
|
46
|
+
content: 2,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
width: 190,
|
|
50
|
+
height: 190,
|
|
51
|
+
marginRight: 10,
|
|
52
|
+
marginBottom: 10,
|
|
53
|
+
color: randomColor(),
|
|
54
|
+
content: 3,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
width: 90,
|
|
58
|
+
height: 90,
|
|
59
|
+
marginRight: 10,
|
|
60
|
+
marginBottom: 10,
|
|
61
|
+
color: randomColor(),
|
|
62
|
+
content: 4,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
width: 90,
|
|
66
|
+
height: 90,
|
|
67
|
+
marginRight: 10,
|
|
68
|
+
marginBottom: 10,
|
|
69
|
+
color: randomColor(),
|
|
70
|
+
content: 5,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
for (let i = 0; i < 5; i++) {
|
|
75
|
+
data.push(
|
|
76
|
+
{
|
|
77
|
+
width: 90,
|
|
78
|
+
height: 190,
|
|
79
|
+
marginRight: 10,
|
|
80
|
+
marginBottom: 10,
|
|
81
|
+
color: randomColor(),
|
|
82
|
+
content: 6 + i * 2,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
width: 90,
|
|
86
|
+
height: 90,
|
|
87
|
+
marginRight: 10,
|
|
88
|
+
marginBottom: 10,
|
|
89
|
+
color: randomColor(),
|
|
90
|
+
content: 6 + i * 2 + 1,
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return data;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const measures = (data) => {
|
|
98
|
+
return {
|
|
99
|
+
width: data.width,
|
|
100
|
+
height: data.height,
|
|
101
|
+
marginRight: data.marginRight,
|
|
102
|
+
marginBottom: data.marginBottom,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// callbacks
|
|
107
|
+
const onEdge = (edgeInfo) => {
|
|
108
|
+
console.log(TAG, "onEdge", edgeInfo);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const onFocus = () => {
|
|
112
|
+
console.log(TAG, "onFocus");
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const onBlur = () => {
|
|
116
|
+
console.log(TAG, "onBlur");
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const onScroll = (start, range, totalSize) => {
|
|
120
|
+
console.log(TAG, "onScroll", start, range, totalSize);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const widgetLayout = {
|
|
124
|
+
left: 50,
|
|
125
|
+
top: 50,
|
|
126
|
+
width: 500,
|
|
127
|
+
height: 300,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
onMounted(() => {
|
|
131
|
+
//组件mount后设置焦点
|
|
132
|
+
focusHub.setFocus("mainMw");
|
|
133
|
+
});
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<template>
|
|
137
|
+
<div
|
|
138
|
+
:style="{
|
|
139
|
+
width: 1920,
|
|
140
|
+
height: 1080,
|
|
141
|
+
backgroundColor: '#007788',
|
|
142
|
+
}"
|
|
143
|
+
/>
|
|
144
|
+
<metro-widget
|
|
145
|
+
name="mainMw"
|
|
146
|
+
:left="widgetLayout.left"
|
|
147
|
+
:top="widgetLayout.top"
|
|
148
|
+
:width="widgetLayout.width"
|
|
149
|
+
:height="widgetLayout.height"
|
|
150
|
+
:provideData="provideData"
|
|
151
|
+
:direction="HORIZONTAL"
|
|
152
|
+
:measures="measures"
|
|
153
|
+
:onEdge="onEdge"
|
|
154
|
+
:onFocus="onFocus"
|
|
155
|
+
:onBlur="onBlur"
|
|
156
|
+
:onScroll="onScroll"
|
|
157
|
+
>
|
|
158
|
+
<template #renderItem="{ data, onAction }">
|
|
159
|
+
<item :data="data" :onAction="onAction" />
|
|
160
|
+
</template>
|
|
161
|
+
</metro-widget>
|
|
162
|
+
</template>
|