@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,159 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-04-20 21:05:26
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:16:52
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, shallowRef, reactive, onMounted } from "vue";
|
|
10
|
+
import { useRouter } from "vue-router";
|
|
11
|
+
import { jJsvRuntimeBridge, JsvFilterView } from "jsview";
|
|
12
|
+
import sample from "./jpegDemo.jpeg";
|
|
13
|
+
import webpSample from "./webpDemo.webp";
|
|
14
|
+
import AnimatePic from "./AnimatePic.vue";
|
|
15
|
+
import VideoLayer from "./VideoLayer.vue";
|
|
16
|
+
|
|
17
|
+
let viewId = -1;
|
|
18
|
+
let enableFilter = ref(true);
|
|
19
|
+
let filterType = reactive({
|
|
20
|
+
type: "gray-down",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
|
|
25
|
+
const _onKeyDown = (ev) => {
|
|
26
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
27
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
28
|
+
} else {
|
|
29
|
+
if (ev.keyCode == 13) {
|
|
30
|
+
if (filterType.type == null) {
|
|
31
|
+
filterType.type = "gray-down";
|
|
32
|
+
} else {
|
|
33
|
+
filterType.type = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<jsv-focus-block
|
|
46
|
+
autoFocus
|
|
47
|
+
:onAction="{
|
|
48
|
+
onKeyDown: _onKeyDown,
|
|
49
|
+
}"
|
|
50
|
+
:style="{
|
|
51
|
+
width: 1920,
|
|
52
|
+
height: 1080,
|
|
53
|
+
backgroundColor: '#007788',
|
|
54
|
+
}"
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
id="main-test"
|
|
58
|
+
:style="{
|
|
59
|
+
left: 400,
|
|
60
|
+
}"
|
|
61
|
+
>
|
|
62
|
+
<jsv-filter-view
|
|
63
|
+
:width="501"
|
|
64
|
+
:height="401"
|
|
65
|
+
ref="filter1"
|
|
66
|
+
:filterType="this.filterType.type"
|
|
67
|
+
>
|
|
68
|
+
<div
|
|
69
|
+
:style="{
|
|
70
|
+
left: 0,
|
|
71
|
+
top: 0,
|
|
72
|
+
width: 400,
|
|
73
|
+
height: 350,
|
|
74
|
+
backgroundImage: `url(${sample})`,
|
|
75
|
+
}"
|
|
76
|
+
></div>
|
|
77
|
+
<!-- 测试双层FBO (FilterView + opacity变化) 的透过处理(video播放) -->
|
|
78
|
+
<video-layer :top="20" :left="45" :width="310" :height="310" />
|
|
79
|
+
</jsv-filter-view>
|
|
80
|
+
<div
|
|
81
|
+
:style="{
|
|
82
|
+
left: 450,
|
|
83
|
+
top: 0,
|
|
84
|
+
width: 400,
|
|
85
|
+
height: 350,
|
|
86
|
+
backgroundImage: `url(${sample})`,
|
|
87
|
+
}"
|
|
88
|
+
></div>
|
|
89
|
+
|
|
90
|
+
<jsv-filter-view
|
|
91
|
+
:top="400"
|
|
92
|
+
:width="402"
|
|
93
|
+
:height="402"
|
|
94
|
+
ref="filter2"
|
|
95
|
+
:filterType="this.filterType.type"
|
|
96
|
+
>
|
|
97
|
+
<div
|
|
98
|
+
:style="{
|
|
99
|
+
width: 300,
|
|
100
|
+
height: 300,
|
|
101
|
+
backgroundImage: `url(${webpSample})`,
|
|
102
|
+
}"
|
|
103
|
+
></div>
|
|
104
|
+
<!-- 测试FBO + 形变效果 -->
|
|
105
|
+
<animate-pic />
|
|
106
|
+
</jsv-filter-view>
|
|
107
|
+
<div
|
|
108
|
+
:style="{
|
|
109
|
+
left: 450,
|
|
110
|
+
top: 400,
|
|
111
|
+
width: 300,
|
|
112
|
+
height: 300,
|
|
113
|
+
backgroundImage: `url(${webpSample})`,
|
|
114
|
+
}"
|
|
115
|
+
></div>
|
|
116
|
+
</div>
|
|
117
|
+
</jsv-focus-block>
|
|
118
|
+
<div
|
|
119
|
+
className="guideText"
|
|
120
|
+
:style="{
|
|
121
|
+
left: 10,
|
|
122
|
+
top: 30,
|
|
123
|
+
width: 400,
|
|
124
|
+
height: 200,
|
|
125
|
+
}"
|
|
126
|
+
>
|
|
127
|
+
{{
|
|
128
|
+
`1. 布局说明: \n\
|
|
129
|
+
第1行第1列为黑白图(含透明动画+video),第2列为原图\n\
|
|
130
|
+
第2行第1列为黑白图(透明+变形动画),第2列为原图\n\
|
|
131
|
+
\n\
|
|
132
|
+
2. 操作说明
|
|
133
|
+
按OK键关闭/开启第1列的黑白滤镜\n\
|
|
134
|
+
\n\
|
|
135
|
+
3. 观测内容\n\
|
|
136
|
+
A. 第1列是否正常切换黑白/彩色效果\n\
|
|
137
|
+
B. 第1列的上下两个区域是否都含有淡出的动画
|
|
138
|
+
C. 第1行第1列是否看到视频(彩色)\n\
|
|
139
|
+
`
|
|
140
|
+
}}
|
|
141
|
+
</div>
|
|
142
|
+
</template>
|
|
143
|
+
|
|
144
|
+
<style scoped>
|
|
145
|
+
.guideText {
|
|
146
|
+
color: #ffffff;
|
|
147
|
+
font-size: 16;
|
|
148
|
+
line-height: 18;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@keyframes rotate {
|
|
152
|
+
from {
|
|
153
|
+
transform: rotate3d(0, 0, 1, 0);
|
|
154
|
+
}
|
|
155
|
+
to {
|
|
156
|
+
transform: rotate3d(0, 0, 1, 360deg);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { JsvVideo } from "jsview";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
top: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 0,
|
|
8
|
+
},
|
|
9
|
+
left: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 0,
|
|
12
|
+
},
|
|
13
|
+
width: {
|
|
14
|
+
type: Number,
|
|
15
|
+
require: true,
|
|
16
|
+
},
|
|
17
|
+
height: {
|
|
18
|
+
type: Number,
|
|
19
|
+
require: true,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// const video_url = "http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20210207/52fae4231350c85fec605b47bbe479c5.mp4";
|
|
24
|
+
const video_url =
|
|
25
|
+
"http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style scoped>
|
|
29
|
+
@keyframes opacityVideoDemo_CompositeOpacity {
|
|
30
|
+
from {
|
|
31
|
+
opacity: 0.1;
|
|
32
|
+
}
|
|
33
|
+
to {
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<div
|
|
40
|
+
className="blockStyle"
|
|
41
|
+
:style="{
|
|
42
|
+
top: props.top,
|
|
43
|
+
left: props.left,
|
|
44
|
+
width: props.width,
|
|
45
|
+
height: props.height,
|
|
46
|
+
backgroundColor: '#0000FF',
|
|
47
|
+
animation: 'opacityVideoDemo_CompositeOpacity 3s infinite',
|
|
48
|
+
}"
|
|
49
|
+
>
|
|
50
|
+
<jsv-video
|
|
51
|
+
:src="video_url"
|
|
52
|
+
autoplay="autoplay"
|
|
53
|
+
loop="loop"
|
|
54
|
+
:style="{
|
|
55
|
+
top: 5,
|
|
56
|
+
left: 5,
|
|
57
|
+
width: props.width - 10,
|
|
58
|
+
height: props.height - 10,
|
|
59
|
+
}"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
Binary file
|
|
Binary file
|
package/FlipCard/App.vue
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useRouter } from "vue-router";
|
|
3
|
+
import { ref, shallowRef } from "vue";
|
|
4
|
+
import { HORIZONTAL, MetroWidget } from "jsview";
|
|
5
|
+
import FlipCard from "./FlipCard.vue";
|
|
6
|
+
import { data } from "./data.js";
|
|
7
|
+
import redEgg from "./assets/red_egg.png";
|
|
8
|
+
import blueEgg from "./assets/blue_egg.png";
|
|
9
|
+
|
|
10
|
+
const name = "/flipCard";
|
|
11
|
+
const focusNode = shallowRef(null);
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
|
|
14
|
+
const onKeyDown = (ev) => {
|
|
15
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
16
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
17
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
const measures = (item) => {
|
|
24
|
+
return {
|
|
25
|
+
width: item.blocks.w,
|
|
26
|
+
height: item.blocks.h,
|
|
27
|
+
focusable: item.focusable,
|
|
28
|
+
hasSub: item.hasSub,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const onFocus = () => {
|
|
32
|
+
focusNode.value.findBlockByName(name).requestFocus();
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<jsv-focus-block
|
|
38
|
+
ref="focusNode"
|
|
39
|
+
autoFocus
|
|
40
|
+
:onAction="{
|
|
41
|
+
onKeyDown: onKeyDown,
|
|
42
|
+
onFocus: onFocus,
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
<metro-widget
|
|
46
|
+
:name="name"
|
|
47
|
+
:width="1280"
|
|
48
|
+
:height="720"
|
|
49
|
+
:padding="{ left: 50, top: 100, right: 20, bottom: 20 }"
|
|
50
|
+
:data="data"
|
|
51
|
+
:direction="HORIZONTAL"
|
|
52
|
+
:measures="measures"
|
|
53
|
+
>
|
|
54
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
55
|
+
<FlipCard
|
|
56
|
+
:data="data"
|
|
57
|
+
:query="query"
|
|
58
|
+
:onEdge="onEdge"
|
|
59
|
+
:onAction="onAction"
|
|
60
|
+
:width="191"
|
|
61
|
+
:height="252"
|
|
62
|
+
:backImg="redEgg"
|
|
63
|
+
:foreImg="blueEgg"
|
|
64
|
+
:perspective="300"
|
|
65
|
+
:initFlipped="false"
|
|
66
|
+
:name="name + '/' + data.id"
|
|
67
|
+
/>
|
|
68
|
+
</template>
|
|
69
|
+
</metro-widget>
|
|
70
|
+
</jsv-focus-block>
|
|
71
|
+
</template>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, shallowRef } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
initFlipped: Boolean,
|
|
5
|
+
width: Number,
|
|
6
|
+
height: Number,
|
|
7
|
+
backImg: String,
|
|
8
|
+
foreImg: String,
|
|
9
|
+
perspective: Number,
|
|
10
|
+
data: Object,
|
|
11
|
+
query: Object,
|
|
12
|
+
onEdge: Function,
|
|
13
|
+
onAction: Object,
|
|
14
|
+
name: String,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
let flipAnim = ref("");
|
|
18
|
+
let flipped = ref(props.initFlipped);
|
|
19
|
+
let focused = ref(false);
|
|
20
|
+
let keyLocked = false;
|
|
21
|
+
let focusNode = shallowRef(null);
|
|
22
|
+
|
|
23
|
+
const onFocus = () => {
|
|
24
|
+
focused.value = true;
|
|
25
|
+
focusNode.value.findBlockByName(props.name).requestFocus();
|
|
26
|
+
};
|
|
27
|
+
const onBlur = () => {
|
|
28
|
+
focused.value = false;
|
|
29
|
+
};
|
|
30
|
+
const onClick = () => {};
|
|
31
|
+
const onFlipped = () => {
|
|
32
|
+
flipped.value = !flipped.value;
|
|
33
|
+
keyLocked = false;
|
|
34
|
+
};
|
|
35
|
+
const onKeyDown = (ev) => {
|
|
36
|
+
if (keyLocked) {
|
|
37
|
+
return true;
|
|
38
|
+
} else {
|
|
39
|
+
if (ev.keyCode === 13) {
|
|
40
|
+
flipAnim.value = flipped.value ? "flip 1s" : "flipBack 1s";
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
props.onAction.register("onFocus", onFocus);
|
|
47
|
+
props.onAction.register("onBlur", onBlur);
|
|
48
|
+
props.onAction.register("onClick", onClick);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<jsv-focus-block
|
|
53
|
+
ref="focusNode"
|
|
54
|
+
:name="name"
|
|
55
|
+
:onAction="{
|
|
56
|
+
onKeyDown: onKeyDown,
|
|
57
|
+
}"
|
|
58
|
+
>
|
|
59
|
+
<div :style="{ width, height, perspective }">
|
|
60
|
+
<div
|
|
61
|
+
:style="{
|
|
62
|
+
width,
|
|
63
|
+
height,
|
|
64
|
+
animation: flipAnim,
|
|
65
|
+
transformStyle: 'preserve-3d',
|
|
66
|
+
backgroundColor: '#FFFF00',
|
|
67
|
+
}"
|
|
68
|
+
:onAnimationEnd="onFlipped"
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
:style="{
|
|
72
|
+
width,
|
|
73
|
+
height,
|
|
74
|
+
backgroundImage: backImg,
|
|
75
|
+
backfaceVisibility: 'hidden',
|
|
76
|
+
transform: flipped ? '' : 'rotate3d(0,1,0,180deg)',
|
|
77
|
+
}"
|
|
78
|
+
></div>
|
|
79
|
+
<div
|
|
80
|
+
:style="{
|
|
81
|
+
width,
|
|
82
|
+
height,
|
|
83
|
+
backgroundImage: foreImg,
|
|
84
|
+
backfaceVisibility: 'hidden',
|
|
85
|
+
transform: flipped ? 'rotate3d(0,1,0,-180deg)' : '',
|
|
86
|
+
}"
|
|
87
|
+
></div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
<div
|
|
91
|
+
v-if="focused"
|
|
92
|
+
:style="{ width: 20, height: 20, backgroundColor: '#FF0000' }"
|
|
93
|
+
></div>
|
|
94
|
+
</jsv-focus-block>
|
|
95
|
+
</template>
|
|
96
|
+
<style>
|
|
97
|
+
@keyframes flip {
|
|
98
|
+
from {
|
|
99
|
+
transform: rotate3d(0, 1, 0, 0deg);
|
|
100
|
+
transform-origin: center center;
|
|
101
|
+
}
|
|
102
|
+
to {
|
|
103
|
+
transform: rotate3d(0, 1, 0, 180deg);
|
|
104
|
+
transform-origin: center center;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@keyframes flipBack {
|
|
109
|
+
from {
|
|
110
|
+
transform: rotate3d(0, 1, 0, 0deg);
|
|
111
|
+
transform-origin: center center;
|
|
112
|
+
}
|
|
113
|
+
to {
|
|
114
|
+
transform: rotate3d(0, 1, 0, -180deg);
|
|
115
|
+
transform-origin: center center;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
Binary file
|
|
Binary file
|
package/FlipCard/data.js
ADDED
package/GridDemo/App.vue
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-05-06 19:32:53
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:39:09
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { jJsvRuntimeBridge, JsvGrid, LineType, EdgeDirection } from "jsview";
|
|
10
|
+
import { reactive, ref, shallowRef, onMounted } from "vue";
|
|
11
|
+
import { useRouter } from "vue-router";
|
|
12
|
+
import ItemVue from "./Item.vue";
|
|
13
|
+
import FocusItem from "./FocusItem.vue";
|
|
14
|
+
const lineType = new LineType(1, 3);
|
|
15
|
+
const name1 = "updatePage1";
|
|
16
|
+
const name2 = "updatePage2";
|
|
17
|
+
const widget1 = shallowRef(null);
|
|
18
|
+
const widget2 = shallowRef(null);
|
|
19
|
+
const router = useRouter();
|
|
20
|
+
const _provideData1 = () => {
|
|
21
|
+
let data = [];
|
|
22
|
+
for (let i = 0; i < 113; i++) {
|
|
23
|
+
data.push({
|
|
24
|
+
content: i + "_CCCCCCCCCCCCCCCCCCCCCCC",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
const _provideData2 = () => {
|
|
30
|
+
let data2 = [];
|
|
31
|
+
for (let i = 0; i < 113; i++) {
|
|
32
|
+
data2.push({
|
|
33
|
+
name: i + "_D",
|
|
34
|
+
baseColor: i,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return data2;
|
|
38
|
+
};
|
|
39
|
+
const _provideData3 = () => {
|
|
40
|
+
return [];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const _onEdge1 = (info) => {
|
|
44
|
+
if (info.direction == EdgeDirection.right) {
|
|
45
|
+
widget2.value.getFocusBlockRef().findBlockByName(name2).requestFocus();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const _onEdge2 = (info) => {
|
|
49
|
+
if (info.direction == EdgeDirection.left) {
|
|
50
|
+
widget1.value.getFocusBlockRef().findBlockByName(name1).requestFocus();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const _onKeyDown = (ev) => {
|
|
54
|
+
console.log("app onkeydown");
|
|
55
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
56
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
onMounted(() => {
|
|
62
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
63
|
+
widget2.value.getFocusBlockRef()?.findBlockByName(name2).requestFocus();
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<jsv-focus-block
|
|
69
|
+
autoFocus
|
|
70
|
+
:onAction="{
|
|
71
|
+
onKeyDown: _onKeyDown,
|
|
72
|
+
}"
|
|
73
|
+
:style="{
|
|
74
|
+
width: 1920,
|
|
75
|
+
height: 1080,
|
|
76
|
+
backgroundColor: '#FFFFFF',
|
|
77
|
+
}"
|
|
78
|
+
><jsv-grid
|
|
79
|
+
ref="widget1"
|
|
80
|
+
:name="name1"
|
|
81
|
+
:left="50"
|
|
82
|
+
:top="50"
|
|
83
|
+
:provideData="_provideData1"
|
|
84
|
+
:row="4"
|
|
85
|
+
:column="5"
|
|
86
|
+
:itemSize="{
|
|
87
|
+
width: 100,
|
|
88
|
+
height: 50,
|
|
89
|
+
}"
|
|
90
|
+
:gapInfo="{
|
|
91
|
+
row: 10,
|
|
92
|
+
column: 10,
|
|
93
|
+
}"
|
|
94
|
+
:verticalUpdate="true"
|
|
95
|
+
:columnFirst="true"
|
|
96
|
+
:onEdge="_onEdge1"
|
|
97
|
+
:initFocusId="21"
|
|
98
|
+
:loopUpdate="true"
|
|
99
|
+
>
|
|
100
|
+
<template #renderItem="{ userData, widgetData, onAction }">
|
|
101
|
+
<item-vue
|
|
102
|
+
:userData="userData"
|
|
103
|
+
:widgetData="widgetData"
|
|
104
|
+
:onAction="onAction"
|
|
105
|
+
/>
|
|
106
|
+
</template>
|
|
107
|
+
</jsv-grid>
|
|
108
|
+
<div
|
|
109
|
+
:style="{
|
|
110
|
+
left: 100,
|
|
111
|
+
top: 300,
|
|
112
|
+
width: 300,
|
|
113
|
+
height: 50,
|
|
114
|
+
fontSize: 30,
|
|
115
|
+
}"
|
|
116
|
+
>
|
|
117
|
+
纵向排布, 翻页模式
|
|
118
|
+
</div>
|
|
119
|
+
<div
|
|
120
|
+
:style="{
|
|
121
|
+
left: 700,
|
|
122
|
+
}"
|
|
123
|
+
>
|
|
124
|
+
<jsv-grid
|
|
125
|
+
ref="widget2"
|
|
126
|
+
:name="name2"
|
|
127
|
+
:left="50"
|
|
128
|
+
:top="50"
|
|
129
|
+
:provideData="_provideData2"
|
|
130
|
+
:row="4"
|
|
131
|
+
:column="5"
|
|
132
|
+
:itemSize="{
|
|
133
|
+
width: 100,
|
|
134
|
+
height: 50,
|
|
135
|
+
}"
|
|
136
|
+
:gapInfo="{
|
|
137
|
+
row: 10,
|
|
138
|
+
column: 10,
|
|
139
|
+
}"
|
|
140
|
+
:verticalUpdate="false"
|
|
141
|
+
:columnFirst="true"
|
|
142
|
+
:onEdge="_onEdge2"
|
|
143
|
+
:updateType="lineType"
|
|
144
|
+
:initFocusId="0"
|
|
145
|
+
>
|
|
146
|
+
<template #renderItem="{ userData, widgetData, onAction }">
|
|
147
|
+
<focus-item
|
|
148
|
+
:userData="userData"
|
|
149
|
+
:widgetData="widgetData"
|
|
150
|
+
:onAction="onAction"
|
|
151
|
+
/>
|
|
152
|
+
</template>
|
|
153
|
+
</jsv-grid>
|
|
154
|
+
<div
|
|
155
|
+
:style="{
|
|
156
|
+
left: 100,
|
|
157
|
+
top: 300,
|
|
158
|
+
width: 300,
|
|
159
|
+
height: 50,
|
|
160
|
+
fontSize: 30,
|
|
161
|
+
}"
|
|
162
|
+
>
|
|
163
|
+
横向排布, 逐行刷新
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div
|
|
168
|
+
:style="{
|
|
169
|
+
top: 500,
|
|
170
|
+
}"
|
|
171
|
+
>
|
|
172
|
+
<jsv-grid
|
|
173
|
+
ref="widget3"
|
|
174
|
+
name="empty"
|
|
175
|
+
:left="50"
|
|
176
|
+
:top="50"
|
|
177
|
+
:provideData="_provideData3"
|
|
178
|
+
:row="4"
|
|
179
|
+
:column="5"
|
|
180
|
+
:itemSize="{
|
|
181
|
+
width: 100,
|
|
182
|
+
height: 50,
|
|
183
|
+
}"
|
|
184
|
+
:gapInfo="{
|
|
185
|
+
row: 10,
|
|
186
|
+
column: 10,
|
|
187
|
+
}"
|
|
188
|
+
:verticalUpdate="false"
|
|
189
|
+
:columnFirst="true"
|
|
190
|
+
:onEdge="_onEdge2"
|
|
191
|
+
:updateType="lineType"
|
|
192
|
+
:initFocusId="0"
|
|
193
|
+
>
|
|
194
|
+
<template #renderItem="{ userData, widgetData, onAction }">
|
|
195
|
+
<item-vue
|
|
196
|
+
:userData="userData"
|
|
197
|
+
:widgetData="widgetData"
|
|
198
|
+
:onAction="onAction"
|
|
199
|
+
/>
|
|
200
|
+
</template>
|
|
201
|
+
</jsv-grid>
|
|
202
|
+
<div
|
|
203
|
+
:style="{
|
|
204
|
+
left: 100,
|
|
205
|
+
top: 300,
|
|
206
|
+
width: 300,
|
|
207
|
+
height: 50,
|
|
208
|
+
fontSize: 30,
|
|
209
|
+
}"
|
|
210
|
+
>
|
|
211
|
+
空数据
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</jsv-focus-block>
|
|
215
|
+
</template>
|