@shijiu/jsview-vue-samples 1.9.747
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/AnimPicture/App.vue +207 -0
- package/AnimPicture/assets/animated_webp.webp +0 -0
- package/AnimPicture/assets/ball_3.webp +0 -0
- package/AnimPicture/assets/girl_run.gif +0 -0
- package/AnimPicture/assets/quan.webp +0 -0
- package/Basic/App.vue +134 -0
- package/Basic/assets/border.png +0 -0
- package/Basic/assets/border2.png +0 -0
- package/Basic/assets/icon.png +0 -0
- package/Basic/assets/test.jpg +0 -0
- package/Basic/components/ContentBlock.vue +38 -0
- package/Basic/components/FontStyle.css +16 -0
- package/Basic/components/anim/AnimGroup.vue +66 -0
- package/Basic/components/anim/AnimKeyframeBasic.vue +119 -0
- package/Basic/components/anim/AnimKeyframeComposite.vue +52 -0
- package/Basic/components/anim/AnimTransition.vue +157 -0
- package/Basic/components/div/DivBackground.vue +44 -0
- package/Basic/components/div/DivClip.vue +159 -0
- package/Basic/components/div/DivCssScoped.vue +20 -0
- package/Basic/components/div/DivCssVar.vue +53 -0
- package/Basic/components/div/DivGroup1.vue +47 -0
- package/Basic/components/div/DivGroup2.vue +65 -0
- package/Basic/components/div/DivLayout.vue +70 -0
- package/Basic/components/div/DivRadius.vue +65 -0
- package/Basic/components/div/DivTransform.vue +32 -0
- package/Basic/components/img/ImageGroup.vue +31 -0
- package/Basic/components/img/ImgLayout.vue +41 -0
- package/Basic/components/panel/Panel1.vue +55 -0
- package/Basic/components/panel/Panel2.vue +31 -0
- package/Basic/components/panel/TitleBar.vue +29 -0
- package/Basic/components/text/TextAlign.vue +66 -0
- package/Basic/components/text/TextEmoji.vue +26 -0
- package/Basic/components/text/TextFontStyle.vue +89 -0
- package/Basic/components/text/TextGroup1.vue +49 -0
- package/Basic/components/text/TextGroup2.vue +28 -0
- package/Basic/components/text/TextOverflow.vue +110 -0
- package/BasicFocusControl/App.vue +104 -0
- package/BasicFocusControl/components/BaseBlock.vue +50 -0
- package/BasicFocusControl/components/MainArea.vue +83 -0
- package/BasicFocusControl/components/MainAreaLeftBlock.vue +17 -0
- package/BasicFocusControl/components/MainAreaRightBlock.vue +27 -0
- package/BasicFocusControl/components/SideBar.vue +58 -0
- package/BasicFocusControl/components/SideBarBlock.vue +27 -0
- package/Collision/App.vue +452 -0
- package/ColorSpace/App.vue +126 -0
- package/ColorSpace/bmpDemo.bmp +0 -0
- package/ColorSpace/jpegDemo.jpeg +0 -0
- package/ColorSpace/pngDemo.png +0 -0
- package/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/DemoHomepage/App.vue +27 -0
- package/DemoHomepage/components/BodyFrame.vue +95 -0
- package/DemoHomepage/components/Dialog.vue +94 -0
- package/DemoHomepage/components/Item.vue +77 -0
- package/DemoHomepage/components/TabFrame.vue +85 -0
- package/DemoHomepage/router.js +196 -0
- package/DemoHomepage/views/Homepage.vue +195 -0
- package/FilterDemo/AnimatePic.vue +58 -0
- package/FilterDemo/App.vue +159 -0
- package/FilterDemo/VideoLayer.vue +62 -0
- package/FilterDemo/jpegDemo.jpeg +0 -0
- package/FilterDemo/webpDemo.webp +0 -0
- package/FlipCard/App.vue +71 -0
- package/FlipCard/FlipCard.vue +118 -0
- package/FlipCard/assets/blue_egg.png +0 -0
- package/FlipCard/assets/red_egg.png +0 -0
- package/FlipCard/data.js +13 -0
- package/GridDemo/App.vue +215 -0
- package/GridDemo/ButtonBlock.vue +112 -0
- package/GridDemo/FocusItem.vue +37 -0
- package/GridDemo/Item.vue +93 -0
- package/HashHistory/App.vue +115 -0
- package/HashHistory/components/HorizontalButtonList.vue +91 -0
- package/HashHistory/components/Item.vue +60 -0
- package/HashHistory/router.js +41 -0
- package/HashHistory/views/MainPage.vue +57 -0
- package/HashHistory/views/SubPage.vue +66 -0
- package/ImpactStop/App.vue +435 -0
- package/Input/App.vue +164 -0
- package/Input/FullKeyboard.vue +87 -0
- package/Input/InputPanel.vue +131 -0
- package/Input/KeyboardItem.vue +58 -0
- package/LongImage/App.vue +80 -0
- package/LongImage/Button.vue +58 -0
- package/LongImage/ButtonItem.vue +44 -0
- package/LongImage/LongImageScroll.vue +92 -0
- package/LongImage/Scroll.vue +14 -0
- package/LongImage/assets/1280x7200.jpg +0 -0
- package/LongText/App.vue +96 -0
- package/LongText/Button.vue +51 -0
- package/LongText/ButtonItem.vue +44 -0
- package/LongText/LongTextScroll.vue +192 -0
- package/LongText/Scroll.vue +14 -0
- package/Marquee/App.vue +247 -0
- package/Marquee/longText.js +14 -0
- package/MaskClip/App.vue +122 -0
- package/MaskClip/images/mask-025/config.json +29 -0
- package/MaskClip/images/mask-025/res/1.png +0 -0
- package/MaskClip/images/mask-025/res/2.png +0 -0
- package/MaskClip/images/mask-025/res/3.png +0 -0
- package/MaskClip/images/mask-025/res/4.png +0 -0
- package/MaskClip/images/mask-025/res/icon.png +0 -0
- package/MaskClip/images/mask-025/res/stroke.png +0 -0
- package/MaskClip/images/php.jpg +0 -0
- package/MetroWidgetDemos/Advanced/App.vue +46 -0
- package/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
- package/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
- package/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +116 -0
- package/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/MetroWidgetDemos/Item.vue +85 -0
- package/MetroWidgetDemos/PerformanceTest/App.vue +210 -0
- package/MetroWidgetDemos/PerformanceTest/Item.vue +90 -0
- package/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +386 -0
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +129 -0
- package/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
- package/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
- package/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
- package/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
- package/MetroWidgetDemos/Simple/App.vue +45 -0
- package/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
- package/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/data.js +205 -0
- package/NinePatchDemo/App.vue +145 -0
- package/NinePatchDemo/Item.vue +69 -0
- package/NinePatchDemo/assets/border.png +0 -0
- package/Preload/App.vue +135 -0
- package/Preload/Item.vue +32 -0
- package/Preload/data.js +23 -0
- package/Preload/images/awesomeface.png +0 -0
- package/Preload/images/cat.jpg +0 -0
- package/Preload/images/rank.png +0 -0
- package/Preload/images/rank_focus.png +0 -0
- package/Preload/images/rule.png +0 -0
- package/Preload/images/rule_focus.png +0 -0
- package/Preload/images/start.png +0 -0
- package/Preload/images/start_focus.png +0 -0
- package/QrcodeDemo/App.vue +68 -0
- package/ScaleDownNeon/App.vue +107 -0
- package/SoundPool/App.vue +134 -0
- package/SoundPool/bgmusic.mp3 +0 -0
- package/SoundPool/coin.mp3 +0 -0
- package/SoundPool/jump.mp3 +0 -0
- package/SoundPool/lose.mp3 +0 -0
- package/SoundPool/run.mp3 +0 -0
- package/SprayView/App.vue +272 -0
- package/SprayView/assets/snow.png +0 -0
- package/SpriteImage/App.vue +173 -0
- package/SpriteImage/images/cat_run.png +0 -0
- package/SpriteImage/images/egg_break.json +116 -0
- package/SpriteImage/images/egg_break.png +0 -0
- package/SpriteImage/images/sprite.png +0 -0
- package/TextBox/App.vue +91 -0
- package/TextBox/RenderCenter.vue +133 -0
- package/TextBox/RenderLeft.vue +138 -0
- package/TextBox/RenderOneLine.vue +101 -0
- package/TextBox/RenderRight.vue +131 -0
- package/TextShadowDemo/App.vue +91 -0
- package/TextureAnimation/App.vue +336 -0
- package/TextureAnimation/App2.vue +111 -0
- package/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/TextureAnimation/assets/light.png +0 -0
- package/TextureAnimation/assets/light2.png +0 -0
- package/TextureAnimation/assets/mask.png +0 -0
- package/TextureAnimation/assets/php.jpg +0 -0
- package/TextureAnimation/assets/php2.png +0 -0
- package/TextureAnimation/assets/swipLight.png +0 -0
- package/TextureSize/App.vue +132 -0
- package/TextureSize/bmpDemo.bmp +0 -0
- package/TextureSize/jpegDemo.jpeg +0 -0
- package/TextureSize/jpgDemo.jpg +0 -0
- package/TextureSize/pngDemo.png +0 -0
- package/TextureSize/pngNoAlphaDemo.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +116 -0
- package/ThrowMoveDemo/App.vue +114 -0
- package/ThrowMoveDemo/LRParabolicDemo.vue +115 -0
- package/ThrowMoveDemo/TargetDemo.vue +116 -0
- package/ThrowMoveDemo/UDParabolicDemo.vue +121 -0
- package/TouchSample/App.vue +136 -0
- package/TouchSample/Item.vue +103 -0
- package/TouchSample/MetroWidgetHorizontal.vue +144 -0
- package/TouchSample/MetroWidgetVertical.vue +144 -0
- package/TouchSample/TouchContainerHorizontal.vue +160 -0
- package/TouchSample/TouchContainerVertical.vue +160 -0
- package/TouchSample/data.js +81 -0
- package/TransitPage/App.vue +29 -0
- package/VideoDemo/App.vue +121 -0
- package/VideoDemo/components/Button.vue +58 -0
- package/VideoDemo/components/Controllor.vue +197 -0
- package/VideoDemo/components/VideoFrame.vue +140 -0
- package/VisibleSensorDemo/App.vue +234 -0
- package/package.json +17 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-12 10:45:38
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-09-01 17:04:31
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { VERTICAL, MetroWidget } from "jsview";
|
|
10
|
+
import WidgetItem from "../WidgetItem.vue";
|
|
11
|
+
import { ref, shallowRef, watch, onBeforeUnmount } from "vue";
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
data: {
|
|
15
|
+
type: Object,
|
|
16
|
+
require: true,
|
|
17
|
+
},
|
|
18
|
+
name: {
|
|
19
|
+
type: String,
|
|
20
|
+
require: true,
|
|
21
|
+
},
|
|
22
|
+
onEdge: {
|
|
23
|
+
type: Function,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const widgetRef = shallowRef(null);
|
|
28
|
+
|
|
29
|
+
const provideData = () => {
|
|
30
|
+
return props.data.data;
|
|
31
|
+
};
|
|
32
|
+
const measures = (item) => {
|
|
33
|
+
return {
|
|
34
|
+
width: item.width,
|
|
35
|
+
height: item.height,
|
|
36
|
+
doSlide: false,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const watcher = watch(
|
|
41
|
+
() => props.data,
|
|
42
|
+
(newValue, oldValue) => {
|
|
43
|
+
widgetRef.value?.refreshData();
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
onBeforeUnmount(() => {
|
|
48
|
+
watcher();
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<metro-widget
|
|
55
|
+
ref="widgetRef"
|
|
56
|
+
:name="name"
|
|
57
|
+
:width="data.width"
|
|
58
|
+
:height="data.height"
|
|
59
|
+
:provideData="provideData"
|
|
60
|
+
:direction="VERTICAL"
|
|
61
|
+
:measures="measures"
|
|
62
|
+
:onEdge="onEdge"
|
|
63
|
+
>
|
|
64
|
+
<template #renderItem="{ data, query, onItemEdge, onAction }">
|
|
65
|
+
<widget-item
|
|
66
|
+
:data="data"
|
|
67
|
+
:query="query"
|
|
68
|
+
:onItemEdge="onItemEdge"
|
|
69
|
+
:onAction="onAction"
|
|
70
|
+
></widget-item>
|
|
71
|
+
</template>
|
|
72
|
+
</metro-widget>
|
|
73
|
+
</template>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-12 10:45:19
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-09-01 16:19:51
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { HORIZONTAL, MetroWidget } from "jsview";
|
|
10
|
+
import TabItem from "./TabItem.vue";
|
|
11
|
+
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
data: {
|
|
14
|
+
type: Object,
|
|
15
|
+
require: true,
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
type: String,
|
|
19
|
+
require: true,
|
|
20
|
+
},
|
|
21
|
+
layout: {
|
|
22
|
+
type: Object,
|
|
23
|
+
},
|
|
24
|
+
onEdge: {
|
|
25
|
+
type: Function,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const measures = (item) => {
|
|
30
|
+
return {
|
|
31
|
+
width: item.width,
|
|
32
|
+
height: item.height,
|
|
33
|
+
marginRight: item.marginRight,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const provideData = () => {
|
|
37
|
+
return props.data;
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<jsv-focus-block>
|
|
43
|
+
<metro-widget
|
|
44
|
+
:name="name"
|
|
45
|
+
:width="layout.width"
|
|
46
|
+
:height="layout.height"
|
|
47
|
+
:provideData="provideData"
|
|
48
|
+
:direction="HORIZONTAL"
|
|
49
|
+
:measures="measures"
|
|
50
|
+
:onEdge="onEdge"
|
|
51
|
+
:padding="{
|
|
52
|
+
top: 30,
|
|
53
|
+
left: 60,
|
|
54
|
+
right: 60,
|
|
55
|
+
}"
|
|
56
|
+
>
|
|
57
|
+
<template #renderItem="{ data, query, onAction }">
|
|
58
|
+
<tab-item :data="data" :query="query" :onAction="onAction"></tab-item>
|
|
59
|
+
</template>
|
|
60
|
+
</metro-widget>
|
|
61
|
+
</jsv-focus-block>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-12 14:52:53
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-09-01 17:10:14
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, shallowRef, inject } from "vue";
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
data: Object,
|
|
13
|
+
query: Object,
|
|
14
|
+
onAction: Object,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const globalInfo = inject("globalInfo");
|
|
18
|
+
|
|
19
|
+
const focused = ref(false);
|
|
20
|
+
const active = ref(false);
|
|
21
|
+
|
|
22
|
+
// 自身的焦点状态自己记录, 通过回调来改变
|
|
23
|
+
const onFocus = () => {
|
|
24
|
+
globalInfo.tabId = props.query.id;
|
|
25
|
+
focused.value = true;
|
|
26
|
+
active.value = false;
|
|
27
|
+
};
|
|
28
|
+
const onBlur = () => {
|
|
29
|
+
focused.value = false;
|
|
30
|
+
active.value =
|
|
31
|
+
props.query.getCurrentFocusId().id === props.query.id ? true : false;
|
|
32
|
+
};
|
|
33
|
+
const onClick = () => {
|
|
34
|
+
console.log("tab item onclick ", props.data);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
|
|
38
|
+
props.onAction.register("onFocus", onFocus);
|
|
39
|
+
props.onAction.register("onBlur", onBlur);
|
|
40
|
+
props.onAction.register("onClick", onClick);
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div
|
|
45
|
+
:style="{
|
|
46
|
+
width: data.width,
|
|
47
|
+
height: data.height,
|
|
48
|
+
transform: focused ? 'scale3d(1.2, 1.2, 1.2)' : '',
|
|
49
|
+
transition: 'transform 0.2s linear',
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<div
|
|
53
|
+
v-if="!focused && active"
|
|
54
|
+
:style="{
|
|
55
|
+
left: -2,
|
|
56
|
+
top: -2,
|
|
57
|
+
width: data.width + 4,
|
|
58
|
+
height: data.height + 4,
|
|
59
|
+
backgroundColor: '#00FF00',
|
|
60
|
+
}"
|
|
61
|
+
></div>
|
|
62
|
+
<div
|
|
63
|
+
v-if="focused"
|
|
64
|
+
:style="{
|
|
65
|
+
left: -2,
|
|
66
|
+
top: -2,
|
|
67
|
+
width: data.width + 4,
|
|
68
|
+
height: data.height + 4,
|
|
69
|
+
backgroundColor: '#FF0000',
|
|
70
|
+
}"
|
|
71
|
+
></div>
|
|
72
|
+
<div
|
|
73
|
+
:style="{
|
|
74
|
+
width: data.width,
|
|
75
|
+
height: data.height,
|
|
76
|
+
fontSize: '30px',
|
|
77
|
+
color: '#FFFFFF',
|
|
78
|
+
backgroundColor: data.color,
|
|
79
|
+
}"
|
|
80
|
+
>
|
|
81
|
+
{{ data.content }}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-12 10:30:33
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-09-01 17:05:07
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import AppPage from "./AppPage.vue";
|
|
10
|
+
import { getKeyFramesGroup } from "jsview";
|
|
11
|
+
import { reactive, ref, shallowRef } from "vue";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
components: {
|
|
15
|
+
AppPage,
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
name: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
curIndex: {
|
|
22
|
+
type: Object,
|
|
23
|
+
},
|
|
24
|
+
pageData: {
|
|
25
|
+
type: Array,
|
|
26
|
+
},
|
|
27
|
+
onEdge: {
|
|
28
|
+
type: Function,
|
|
29
|
+
},
|
|
30
|
+
layout: {
|
|
31
|
+
type: Object,
|
|
32
|
+
},
|
|
33
|
+
duration: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 0.3,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
inject: ["globalInfo"],
|
|
39
|
+
provide() {
|
|
40
|
+
return {
|
|
41
|
+
animState: this.animState,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
setup() {
|
|
45
|
+
let styleShell = getKeyFramesGroup();
|
|
46
|
+
let animState = reactive({
|
|
47
|
+
value: 0, //0: 不在动画, 在动画中
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
refName0: "page0",
|
|
51
|
+
refName1: "page1",
|
|
52
|
+
styleShell,
|
|
53
|
+
animState,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
curPage: 0,
|
|
59
|
+
page0Show: true,
|
|
60
|
+
page1Show: false,
|
|
61
|
+
page0Data: this.pageData[0],
|
|
62
|
+
page1Data: null,
|
|
63
|
+
page0Left: 0,
|
|
64
|
+
page1Left: 1280,
|
|
65
|
+
page0Anim: {
|
|
66
|
+
anim: "",
|
|
67
|
+
onend: null,
|
|
68
|
+
},
|
|
69
|
+
page1Anim: {
|
|
70
|
+
anim: "",
|
|
71
|
+
onend: null,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
$_appSwiper_onFocus() {
|
|
77
|
+
let curPageData = this.curPage === 0 ? this.page0Data : this.page1Data;
|
|
78
|
+
this.$refs.focusNode?.findBlockByName(curPageData.name).requestFocus();
|
|
79
|
+
},
|
|
80
|
+
$_appSwiper_tabIdWatcher(newValue, oldValue) {
|
|
81
|
+
console.log("AppSwiper curIndex changed ", newValue, oldValue);
|
|
82
|
+
if (newValue != oldValue) {
|
|
83
|
+
let direction = newValue > oldValue ? "left" : "right";
|
|
84
|
+
if (this.curPage == 0) {
|
|
85
|
+
this.curPage = 1;
|
|
86
|
+
this.page1Data = this.pageData[newValue];
|
|
87
|
+
this.page1Show = true;
|
|
88
|
+
this.animState.value = 1;
|
|
89
|
+
this.page0Anim = {
|
|
90
|
+
anim: `app-swiper-${direction}-slide-out ${this.duration}s`,
|
|
91
|
+
onend: () => {
|
|
92
|
+
this.page0Show = false;
|
|
93
|
+
this.page0Data = null;
|
|
94
|
+
this.animState.value = 0;
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
this.page1Anim = {
|
|
98
|
+
anim: `app-swiper-${direction}-slide-in ${this.duration}s`,
|
|
99
|
+
onend: null,
|
|
100
|
+
};
|
|
101
|
+
} else {
|
|
102
|
+
this.curPage = 0;
|
|
103
|
+
this.page0Data = this.pageData[newValue];
|
|
104
|
+
this.page0Show = true;
|
|
105
|
+
this.animState.value = 1;
|
|
106
|
+
this.page0Anim = {
|
|
107
|
+
anim: `app-swiper-${direction}-slide-in ${this.duration}s`,
|
|
108
|
+
onend: null,
|
|
109
|
+
};
|
|
110
|
+
this.page1Anim = {
|
|
111
|
+
anim: `app-swiper-${direction}-slide-out ${this.duration}s`,
|
|
112
|
+
onend: () => {
|
|
113
|
+
this.page1Show = false;
|
|
114
|
+
this.page1Data = null;
|
|
115
|
+
this.animState.value = 0;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
$_appSwiper_initAnimation() {
|
|
122
|
+
let leftSlideOutDefine = `@keyframes app-swiper-left-slide-out {
|
|
123
|
+
from {
|
|
124
|
+
transform: translate3d(0px, 0px, 0px);
|
|
125
|
+
}
|
|
126
|
+
to {
|
|
127
|
+
transform: translate3d(${-this.layout.width}px, 0px, 0px);
|
|
128
|
+
}
|
|
129
|
+
}`;
|
|
130
|
+
let leftSlideInDefine = `@keyframes app-swiper-left-slide-in {
|
|
131
|
+
from {
|
|
132
|
+
transform: translate3d(${this.layout.width}px, 0px, 0px);
|
|
133
|
+
}
|
|
134
|
+
to {
|
|
135
|
+
transform: translate3d(0px, 0px, 0px);
|
|
136
|
+
}
|
|
137
|
+
}`;
|
|
138
|
+
let rightSlideOutDefine = `@keyframes app-swiper-right-slide-out {
|
|
139
|
+
from {
|
|
140
|
+
transform: translate3d(0px, 0px, 0px);
|
|
141
|
+
}
|
|
142
|
+
to {
|
|
143
|
+
transform: translate3d(${this.layout.width}px, 0px, 0px);
|
|
144
|
+
}
|
|
145
|
+
}`;
|
|
146
|
+
let rightSlideInDefine = `@keyframes app-swiper-right-slide-in {
|
|
147
|
+
from {
|
|
148
|
+
transform: translate3d(${-this.layout.width}px, 0px, 0px);
|
|
149
|
+
}
|
|
150
|
+
to {
|
|
151
|
+
transform: translate3d(0px, 0px, 0px);
|
|
152
|
+
}
|
|
153
|
+
}`;
|
|
154
|
+
this.styleShell.insertRule(leftSlideOutDefine);
|
|
155
|
+
this.styleShell.insertRule(leftSlideInDefine);
|
|
156
|
+
this.styleShell.insertRule(rightSlideOutDefine);
|
|
157
|
+
this.styleShell.insertRule(rightSlideInDefine);
|
|
158
|
+
},
|
|
159
|
+
$_appSwiper_releaseAnimation() {
|
|
160
|
+
this.styleShell.removeRule("app-swiper-left-slide-out");
|
|
161
|
+
this.styleShell.removeRule("app-swiper-left-slide-in");
|
|
162
|
+
this.styleShell.removeRule("app-swiper-right-slide-out");
|
|
163
|
+
this.styleShell.removeRule("app-swiper-right-slide-in");
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
created() {
|
|
167
|
+
console.log("AppSwiper created", this.globalInfo);
|
|
168
|
+
this.$watch(() => this.globalInfo.tabId, this.$_appSwiper_tabIdWatcher);
|
|
169
|
+
this.$_appSwiper_initAnimation();
|
|
170
|
+
},
|
|
171
|
+
beforeUnmount() {
|
|
172
|
+
this.$_appSwiper_releaseAnimation();
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<template>
|
|
178
|
+
<jsv-focus-block
|
|
179
|
+
:name="name"
|
|
180
|
+
ref="focusNode"
|
|
181
|
+
:onAction="{
|
|
182
|
+
onFocus: $_appSwiper_onFocus,
|
|
183
|
+
}"
|
|
184
|
+
>
|
|
185
|
+
<div
|
|
186
|
+
:style="{
|
|
187
|
+
animation: page0Anim.anim,
|
|
188
|
+
animationFillMode: 'forwards',
|
|
189
|
+
}"
|
|
190
|
+
:onAnimationEnd="page0Anim.onend"
|
|
191
|
+
>
|
|
192
|
+
<app-page
|
|
193
|
+
v-if="page0Show"
|
|
194
|
+
:data="page0Data"
|
|
195
|
+
:name="page0Data.name"
|
|
196
|
+
:onEdge="onEdge"
|
|
197
|
+
></app-page>
|
|
198
|
+
</div>
|
|
199
|
+
<div
|
|
200
|
+
:style="{
|
|
201
|
+
animation: page1Anim.anim,
|
|
202
|
+
animationFillMode: 'forwards',
|
|
203
|
+
}"
|
|
204
|
+
:onAnimationEnd="page1Anim.onend"
|
|
205
|
+
>
|
|
206
|
+
<app-page
|
|
207
|
+
v-if="page1Show"
|
|
208
|
+
:data="page1Data"
|
|
209
|
+
:name="page1Data.name"
|
|
210
|
+
:onEdge="onEdge"
|
|
211
|
+
></app-page>
|
|
212
|
+
</div>
|
|
213
|
+
</jsv-focus-block>
|
|
214
|
+
</template>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-11 13:31:36
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-18 10:03:44
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
+
import { useFocusHub } from "jsview";
|
|
11
|
+
import { simpleDataAbs } from "../data";
|
|
12
|
+
import Item from "../Item.vue";
|
|
13
|
+
const focusHub = useFocusHub();
|
|
14
|
+
|
|
15
|
+
const wholePageSlide = new WholePageSlide();
|
|
16
|
+
|
|
17
|
+
const provideDataAbs = () => {
|
|
18
|
+
return simpleDataAbs;
|
|
19
|
+
};
|
|
20
|
+
const measuresAbs = (item) => {
|
|
21
|
+
return {
|
|
22
|
+
width: item.width,
|
|
23
|
+
height: item.height,
|
|
24
|
+
marginRight: item.marginRight,
|
|
25
|
+
marginBottom: item.marginBottom,
|
|
26
|
+
left: item.left,
|
|
27
|
+
top: item.top,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const onEdgeAbs = (edgeInfo) => {
|
|
31
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
32
|
+
focusHub.setFocus("mw");
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div
|
|
39
|
+
:style="{
|
|
40
|
+
left: 700,
|
|
41
|
+
top: 50,
|
|
42
|
+
width: 700,
|
|
43
|
+
height: 50,
|
|
44
|
+
color: '#FFFFFF',
|
|
45
|
+
fontSize: 30,
|
|
46
|
+
}"
|
|
47
|
+
>
|
|
48
|
+
绝对坐标布局
|
|
49
|
+
</div>
|
|
50
|
+
<!-- 绝对坐标布局, 将layoutType设为absolute, measures返回的对象需要有left,top信息 -->
|
|
51
|
+
<metro-widget
|
|
52
|
+
name="mwAbs"
|
|
53
|
+
:top="150"
|
|
54
|
+
:left="700"
|
|
55
|
+
:provideData="provideDataAbs"
|
|
56
|
+
:width="500"
|
|
57
|
+
:height="400"
|
|
58
|
+
:padding="{
|
|
59
|
+
left: 50,
|
|
60
|
+
top: 50,
|
|
61
|
+
right: 50,
|
|
62
|
+
bottom: 50,
|
|
63
|
+
}"
|
|
64
|
+
:direction="HORIZONTAL"
|
|
65
|
+
:measures="measuresAbs"
|
|
66
|
+
:slideSetting="wholePageSlide"
|
|
67
|
+
:onEdge="onEdgeAbs"
|
|
68
|
+
layoutType="absolute"
|
|
69
|
+
>
|
|
70
|
+
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口 -->
|
|
71
|
+
<template #renderItem="{ data, query, onAction }">
|
|
72
|
+
<item :data="data" :query="query" :onAction="onAction" />
|
|
73
|
+
</template>
|
|
74
|
+
</metro-widget>
|
|
75
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-11 13:31:36
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-18 10:06:28
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
+
import { useRouter } from "vue-router";
|
|
11
|
+
import { useFocusHub } from "jsview";
|
|
12
|
+
import AbsoluteTemplate from "./AbsoluteTemplate.vue";
|
|
13
|
+
import RelativeTemplate from "./RelativeTemplate.vue";
|
|
14
|
+
|
|
15
|
+
const router = useRouter();
|
|
16
|
+
const focusHub = useFocusHub();
|
|
17
|
+
|
|
18
|
+
const onFocus = () => {
|
|
19
|
+
focusHub.setFocus("button");
|
|
20
|
+
};
|
|
21
|
+
const onKeyDown = (ev) => {
|
|
22
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
23
|
+
router.go(-1);
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<jsv-focus-block
|
|
31
|
+
autoFocus
|
|
32
|
+
:onAction="{
|
|
33
|
+
onKeyDown,
|
|
34
|
+
onFocus,
|
|
35
|
+
}"
|
|
36
|
+
:style="{
|
|
37
|
+
width: 1920,
|
|
38
|
+
height: 1080,
|
|
39
|
+
backgroundColor: '#007788',
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
<absolute-template></absolute-template>
|
|
43
|
+
<relative-template></relative-template>
|
|
44
|
+
</jsv-focus-block>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-11 13:31:36
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-18 10:07:01
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
+
import { ref, shallowRef } from "vue";
|
|
11
|
+
import { useFocusHub } from "jsview";
|
|
12
|
+
import { simpleData } from "../data";
|
|
13
|
+
import Item from "../Item.vue";
|
|
14
|
+
|
|
15
|
+
const focusHub = useFocusHub();
|
|
16
|
+
const mwRef = shallowRef(null);
|
|
17
|
+
|
|
18
|
+
const wholePageSlide = new WholePageSlide();
|
|
19
|
+
let innerData = simpleData.concat();
|
|
20
|
+
let dataPool = [];
|
|
21
|
+
|
|
22
|
+
const provideData = () => {
|
|
23
|
+
return innerData;
|
|
24
|
+
};
|
|
25
|
+
const measures = (item) => {
|
|
26
|
+
return {
|
|
27
|
+
width: item.width,
|
|
28
|
+
height: item.height,
|
|
29
|
+
marginRight: item.marginRight,
|
|
30
|
+
marginBottom: item.marginBottom,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const onEdge = (edgeInfo) => {
|
|
34
|
+
// MetroWidget焦点到达边缘后的回调
|
|
35
|
+
if (edgeInfo.direction == EdgeDirection.top) {
|
|
36
|
+
buttonFocus.value = true;
|
|
37
|
+
focusHub.setFocus("button");
|
|
38
|
+
} else if (edgeInfo.direction == EdgeDirection.right) {
|
|
39
|
+
focusHub.setFocus("mwAbs");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const buttonFocus = ref(true);
|
|
44
|
+
const buttonOnKeyDown = (ev) => {
|
|
45
|
+
switch (ev.keyCode) {
|
|
46
|
+
case 40:
|
|
47
|
+
buttonFocus.value = false;
|
|
48
|
+
focusHub.setFocus("mw");
|
|
49
|
+
return true;
|
|
50
|
+
case 13:
|
|
51
|
+
if (innerData.length == simpleData.length) {
|
|
52
|
+
innerData = [];
|
|
53
|
+
dataPool = simpleData.concat();
|
|
54
|
+
} else {
|
|
55
|
+
innerData.push(dataPool.shift());
|
|
56
|
+
}
|
|
57
|
+
mwRef.value?.refreshData(true);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<jsv-focus-block
|
|
66
|
+
name="button"
|
|
67
|
+
:onAction="{
|
|
68
|
+
onKeyDown: buttonOnKeyDown,
|
|
69
|
+
}"
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
:style="{
|
|
73
|
+
left: 100,
|
|
74
|
+
top: 50,
|
|
75
|
+
width: 500,
|
|
76
|
+
height: 100,
|
|
77
|
+
color: '#FFFFFF',
|
|
78
|
+
fontSize: 30,
|
|
79
|
+
backgroundColor: buttonFocus ? '#AA0000' : '#444444',
|
|
80
|
+
}"
|
|
81
|
+
>
|
|
82
|
+
{{ `自适应布局\n获焦时按确认查看时item排布的方式` }}
|
|
83
|
+
</div>
|
|
84
|
+
</jsv-focus-block>
|
|
85
|
+
|
|
86
|
+
<!-- item的排布区域为600*300, 但由于获焦时需要放大, 因此需要往外扩展padding, 合起来宽高为700*400 -->
|
|
87
|
+
<metro-widget
|
|
88
|
+
name="mw"
|
|
89
|
+
ref="mwRef"
|
|
90
|
+
:top="150"
|
|
91
|
+
:left="50"
|
|
92
|
+
:provideData="provideData"
|
|
93
|
+
:width="500"
|
|
94
|
+
:height="400"
|
|
95
|
+
:padding="{
|
|
96
|
+
left: 50,
|
|
97
|
+
top: 50,
|
|
98
|
+
right: 50,
|
|
99
|
+
bottom: 50,
|
|
100
|
+
}"
|
|
101
|
+
:direction="HORIZONTAL"
|
|
102
|
+
:measures="measures"
|
|
103
|
+
:slideSetting="wholePageSlide"
|
|
104
|
+
:onEdge="onEdge"
|
|
105
|
+
>
|
|
106
|
+
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口 -->
|
|
107
|
+
<template #renderItem="{ data, query, onAction }">
|
|
108
|
+
<item :data="data" :query="query" :onAction="onAction" />
|
|
109
|
+
</template>
|
|
110
|
+
</metro-widget>
|
|
111
|
+
</template>
|