@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,116 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-20 18:27:25
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 14:11:39
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import { JsvActorMoveControl, JsvActorMove } from "jsview";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
components: {
|
|
13
|
+
JsvActorMove,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
name: String,
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
direction: 1,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
setup() {
|
|
24
|
+
let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
|
|
25
|
+
let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
throwControl,
|
|
29
|
+
moveControl,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
onKeyDown(ev) {
|
|
34
|
+
if (ev.keyCode === 13) {
|
|
35
|
+
let preDirection = this.direction;
|
|
36
|
+
this.direction = -this.direction;
|
|
37
|
+
this.moveControl.moveToX(195 * this.direction, 250, (x, y) => {
|
|
38
|
+
console.log(`Move end with x=${x} y=${y}`);
|
|
39
|
+
});
|
|
40
|
+
const position = (-100 * preDirection) / 2;
|
|
41
|
+
this.throwControl.throwAlongY(
|
|
42
|
+
-500 * preDirection,
|
|
43
|
+
750 * preDirection,
|
|
44
|
+
{
|
|
45
|
+
type: "catch",
|
|
46
|
+
position,
|
|
47
|
+
direction: -1 * preDirection,
|
|
48
|
+
},
|
|
49
|
+
(x, y) => {
|
|
50
|
+
console.log(`Throw end with x=${x} y=${y}`);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<jsv-focus-block
|
|
63
|
+
ref="focusNode"
|
|
64
|
+
:name="name"
|
|
65
|
+
autoFocus
|
|
66
|
+
:onAction="{
|
|
67
|
+
onKeyDown: onKeyDown,
|
|
68
|
+
}"
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
key="sample1"
|
|
72
|
+
class="detail-font"
|
|
73
|
+
:style="{ top: 150, left: 425, width: 430, height: 40 }"
|
|
74
|
+
>
|
|
75
|
+
拐点前触碰目标点
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
key="DirectText"
|
|
79
|
+
class="font"
|
|
80
|
+
:style="{ top: 250, left: 425, width: 430, height: 40 }"
|
|
81
|
+
>
|
|
82
|
+
{{ `当前方向:${direction > 0 ? "右" : "左"}` }}
|
|
83
|
+
</div>
|
|
84
|
+
<div :style="{ top: 590, left: 625 }">
|
|
85
|
+
<jsv-actor-move key="move" :control="moveControl">
|
|
86
|
+
<jsv-actor-move key="throw" :control="throwControl">
|
|
87
|
+
<div
|
|
88
|
+
:style="{ backgroundColor: '#0916ff', width: 30, height: 30 }"
|
|
89
|
+
></div>
|
|
90
|
+
</jsv-actor-move>
|
|
91
|
+
</jsv-actor-move>
|
|
92
|
+
</div>
|
|
93
|
+
</jsv-focus-block>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<style scoped>
|
|
97
|
+
.font {
|
|
98
|
+
font-size: 32px;
|
|
99
|
+
color: #73665c;
|
|
100
|
+
line-height: 40px;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
text-align: center;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.detail-font {
|
|
108
|
+
font-size: 32px;
|
|
109
|
+
color: #f7f7eb;
|
|
110
|
+
line-height: 30px;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
text-overflow: ellipsis;
|
|
114
|
+
text-align: center;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-20 18:27:25
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2021-10-21 14:07:16
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import { JsvActorMoveControl, JsvActorMove } from "jsview";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
components: {
|
|
13
|
+
JsvActorMove,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
name: String,
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
direction: 1,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
computed: {
|
|
24
|
+
directionDetail() {
|
|
25
|
+
return this.direction < 0 ? "上" : "下";
|
|
26
|
+
},
|
|
27
|
+
detail() {
|
|
28
|
+
return this.direction < 0 ? "向上抛物" : "向下掷物并弹起";
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
setup() {
|
|
32
|
+
let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
|
|
33
|
+
let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
throwControl,
|
|
37
|
+
moveControl,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
onKeyDown(ev) {
|
|
42
|
+
let preDirection = this.direction;
|
|
43
|
+
switch (ev.keyCode) {
|
|
44
|
+
case 13:
|
|
45
|
+
this.direction = -this.direction;
|
|
46
|
+
this.throwControl.throwAlongY(
|
|
47
|
+
-400 * preDirection,
|
|
48
|
+
550 * preDirection,
|
|
49
|
+
{
|
|
50
|
+
type: "catch",
|
|
51
|
+
position: 100 * preDirection,
|
|
52
|
+
direction: preDirection,
|
|
53
|
+
},
|
|
54
|
+
(x, y) => {
|
|
55
|
+
console.log(`Throw end with x=${x} y=${y}`);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<template>
|
|
67
|
+
<jsv-focus-block
|
|
68
|
+
ref="focusNode"
|
|
69
|
+
:name="name"
|
|
70
|
+
autoFocus
|
|
71
|
+
:onAction="{
|
|
72
|
+
onKeyDown: onKeyDown,
|
|
73
|
+
}"
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
key="sample1"
|
|
77
|
+
class="detail-font"
|
|
78
|
+
:style="{ top: 150, left: 425, width: 430, height: 40 }"
|
|
79
|
+
>
|
|
80
|
+
{{ detail }}
|
|
81
|
+
</div>
|
|
82
|
+
<div
|
|
83
|
+
key="DirectText"
|
|
84
|
+
class="font"
|
|
85
|
+
:style="{ top: 250, left: 425, width: 430, height: 40 }"
|
|
86
|
+
>
|
|
87
|
+
{{ `当前方向:${directionDetail}` }}
|
|
88
|
+
</div>
|
|
89
|
+
<div :style="{ top: 590, left: 625 }">
|
|
90
|
+
<jsv-actor-move key="move" :control="moveControl">
|
|
91
|
+
<jsv-actor-move key="throw" :control="throwControl">
|
|
92
|
+
<div
|
|
93
|
+
:style="{ backgroundColor: '#ffb915', width: 30, height: 30 }"
|
|
94
|
+
></div>
|
|
95
|
+
</jsv-actor-move>
|
|
96
|
+
</jsv-actor-move>
|
|
97
|
+
</div>
|
|
98
|
+
</jsv-focus-block>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<style scoped>
|
|
102
|
+
.font {
|
|
103
|
+
font-size: 32px;
|
|
104
|
+
color: #73665c;
|
|
105
|
+
line-height: 40px;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
text-overflow: ellipsis;
|
|
109
|
+
text-align: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.detail-font {
|
|
113
|
+
font-size: 32px;
|
|
114
|
+
color: #f7f7eb;
|
|
115
|
+
line-height: 30px;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
text-align: center;
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-04-10 21:20:39
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 14:12:05
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import MetroWidgetHorizontal from "./MetroWidgetHorizontal.vue";
|
|
10
|
+
import MetroWidgetVertical from "./MetroWidgetVertical.vue";
|
|
11
|
+
import TouchContainerHorizontal from "./TouchContainerHorizontal.vue";
|
|
12
|
+
import TouchContainerVertical from "./TouchContainerVertical.vue";
|
|
13
|
+
import { jJsvRuntimeBridge, JsvTouchContainer } from "jsview";
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
components: {
|
|
17
|
+
MetroWidgetHorizontal,
|
|
18
|
+
MetroWidgetVertical,
|
|
19
|
+
TouchContainerHorizontal,
|
|
20
|
+
JsvTouchContainer,
|
|
21
|
+
TouchContainerVertical,
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
metroVerticalVisible: false,
|
|
26
|
+
metroHorizontalVisible: true,
|
|
27
|
+
touchContainerHorizontalVisible: false,
|
|
28
|
+
touchContainerVerticalVisible: false,
|
|
29
|
+
head: "SimpleWidget 横向",
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
setup() {
|
|
33
|
+
const tabList = [
|
|
34
|
+
"SimpleWidget 横向",
|
|
35
|
+
"SimpleWidget 纵向",
|
|
36
|
+
"TouchContainer 横向",
|
|
37
|
+
"TouchContainer 纵向",
|
|
38
|
+
];
|
|
39
|
+
return {
|
|
40
|
+
tabList,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
methods: {
|
|
44
|
+
_onClick(id) {
|
|
45
|
+
switch (id) {
|
|
46
|
+
case 0:
|
|
47
|
+
this.head = "SimpleWidget 横向";
|
|
48
|
+
this.metroVerticalVisible = false;
|
|
49
|
+
this.metroHorizontalVisible = true;
|
|
50
|
+
this.touchContainerHorizontalVisible = false;
|
|
51
|
+
this.touchContainerVerticalVisible = false;
|
|
52
|
+
break;
|
|
53
|
+
case 1:
|
|
54
|
+
this.head = "SimpleWidget 纵向";
|
|
55
|
+
this.metroVerticalVisible = true;
|
|
56
|
+
this.metroHorizontalVisible = false;
|
|
57
|
+
this.touchContainerHorizontalVisible = false;
|
|
58
|
+
this.touchContainerVerticalVisible = false;
|
|
59
|
+
break;
|
|
60
|
+
case 2:
|
|
61
|
+
this.head = "TouchContainer 横向";
|
|
62
|
+
this.metroVerticalVisible = false;
|
|
63
|
+
this.metroHorizontalVisible = false;
|
|
64
|
+
this.touchContainerHorizontalVisible = true;
|
|
65
|
+
this.touchContainerVerticalVisible = false;
|
|
66
|
+
break;
|
|
67
|
+
case 3:
|
|
68
|
+
this.head = "TouchContainer 纵向";
|
|
69
|
+
this.metroVerticalVisible = false;
|
|
70
|
+
this.metroHorizontalVisible = false;
|
|
71
|
+
this.touchContainerHorizontalVisible = false;
|
|
72
|
+
this.touchContainerVerticalVisible = true;
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
mounted() {
|
|
81
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<div
|
|
88
|
+
:style="{
|
|
89
|
+
width: 1280,
|
|
90
|
+
height: 720 * 2,
|
|
91
|
+
backgroundColor: '#1b2697',
|
|
92
|
+
}"
|
|
93
|
+
>
|
|
94
|
+
<jsv-touch-container
|
|
95
|
+
v-for="(title, index) of tabList"
|
|
96
|
+
:key="'tab' + index"
|
|
97
|
+
:style="{
|
|
98
|
+
left: 50 + 300 * index,
|
|
99
|
+
top: 10,
|
|
100
|
+
width: 280,
|
|
101
|
+
height: 50,
|
|
102
|
+
backgroundColor: '#ff0000',
|
|
103
|
+
fontSize: 18,
|
|
104
|
+
lineHeight: '50px',
|
|
105
|
+
}"
|
|
106
|
+
:onClick="
|
|
107
|
+
() => {
|
|
108
|
+
return this._onClick(index);
|
|
109
|
+
}
|
|
110
|
+
"
|
|
111
|
+
:direction="DIRECTION_DISABLE"
|
|
112
|
+
>
|
|
113
|
+
{{ title }}
|
|
114
|
+
</jsv-touch-container>
|
|
115
|
+
|
|
116
|
+
<div
|
|
117
|
+
:style="{
|
|
118
|
+
left: 30,
|
|
119
|
+
top: 60,
|
|
120
|
+
width: 400,
|
|
121
|
+
height: 50,
|
|
122
|
+
fontSize: 30,
|
|
123
|
+
lineHeight: '50px',
|
|
124
|
+
color: '#f0ef29',
|
|
125
|
+
}"
|
|
126
|
+
>
|
|
127
|
+
{{ head }}
|
|
128
|
+
</div>
|
|
129
|
+
<div :style="{ left: 30, top: 120 }">
|
|
130
|
+
<metro-widget-horizontal v-if="metroHorizontalVisible" />
|
|
131
|
+
<metro-widget-vertical v-if="metroVerticalVisible" />
|
|
132
|
+
<touch-container-horizontal v-if="touchContainerHorizontalVisible" />
|
|
133
|
+
<touch-container-vertical v-if="touchContainerVerticalVisible" />
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</template>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-04-10 21:21:43
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-04-10 21:21:44
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import { getPositionRelativeToView } from "jsview";
|
|
10
|
+
function randomColor() {
|
|
11
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
12
|
+
return (
|
|
13
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
export default {
|
|
17
|
+
props: {
|
|
18
|
+
data: Object,
|
|
19
|
+
query: Object,
|
|
20
|
+
onEdge: Function,
|
|
21
|
+
onAction: Object,
|
|
22
|
+
test: Object,
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
focused: false,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
setup() {
|
|
30
|
+
return {
|
|
31
|
+
randomColor,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
computed: {
|
|
35
|
+
style() {
|
|
36
|
+
return {
|
|
37
|
+
width: this.data.width,
|
|
38
|
+
height: this.data.height,
|
|
39
|
+
color: "#FFFFFF",
|
|
40
|
+
backgroundColor: this.focused ? "#FF0000" : this.data.color,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
onFocus() {
|
|
46
|
+
this.focused = true;
|
|
47
|
+
console.log("cchtest item onfocus", this.data);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
onBlur() {
|
|
51
|
+
this.focused = false;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onClick() {
|
|
55
|
+
console.log(`item ${this.query.id} clicked`);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
created() {
|
|
59
|
+
// console.log("cchtest item created", this.data.content)
|
|
60
|
+
this.onAction.register("onFocus", this.onFocus);
|
|
61
|
+
this.onAction.register("onBlur", this.onBlur);
|
|
62
|
+
this.onAction.register("onClick", this.onClick);
|
|
63
|
+
},
|
|
64
|
+
mounted() {
|
|
65
|
+
// console.log("cchtest item mounted", this.data.content)
|
|
66
|
+
},
|
|
67
|
+
beforeUnmount() {
|
|
68
|
+
// console.log("cchtest item unmount", this.data.content)
|
|
69
|
+
},
|
|
70
|
+
updated() {
|
|
71
|
+
// console.log("cchtest item update", this.data.content)
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<div ref="element" :class="focused ? 'focus' : 'blur'" :style="style">
|
|
78
|
+
{{ data.content }}
|
|
79
|
+
</div>
|
|
80
|
+
<div
|
|
81
|
+
:style="{
|
|
82
|
+
left: data.width / 2,
|
|
83
|
+
top: data.height / 2,
|
|
84
|
+
width: 10,
|
|
85
|
+
height: 10,
|
|
86
|
+
backgroundColor: focused ? '#000000' : '#FF0000',
|
|
87
|
+
}"
|
|
88
|
+
/>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<style scoped>
|
|
92
|
+
.focus {
|
|
93
|
+
transform: scale3d(1, 1, 1);
|
|
94
|
+
transition: transform 0.25s linear;
|
|
95
|
+
font-size: 30px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.blur {
|
|
99
|
+
transform: scale3d(1, 1, 1);
|
|
100
|
+
transition: transform 0.25s linear;
|
|
101
|
+
font-size: 30px;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import {
|
|
3
|
+
HORIZONTAL,
|
|
4
|
+
MetroWidget,
|
|
5
|
+
WholePageSlide,
|
|
6
|
+
SeamlessSlide,
|
|
7
|
+
FixPositionSlide,
|
|
8
|
+
} from "jsview";
|
|
9
|
+
|
|
10
|
+
import Item from "./Item.vue";
|
|
11
|
+
|
|
12
|
+
import { metroWidgetH, measures } from "./data.js";
|
|
13
|
+
import { ref, shallowRef } from "vue";
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
components: {
|
|
17
|
+
MetroWidget,
|
|
18
|
+
Item,
|
|
19
|
+
},
|
|
20
|
+
setup() {
|
|
21
|
+
return {
|
|
22
|
+
measures,
|
|
23
|
+
name: "/metroWidgetH",
|
|
24
|
+
direction: HORIZONTAL,
|
|
25
|
+
wholePageSlide: new WholePageSlide({
|
|
26
|
+
speed: 1.5,
|
|
27
|
+
}),
|
|
28
|
+
seamlessSlide: new SeamlessSlide({
|
|
29
|
+
startPercent: 0.4,
|
|
30
|
+
endPercent: 0.6,
|
|
31
|
+
speed: 0.5,
|
|
32
|
+
}),
|
|
33
|
+
fixPositionSlide: new FixPositionSlide({
|
|
34
|
+
fixPercent: 0.5,
|
|
35
|
+
speed: 0.5,
|
|
36
|
+
}),
|
|
37
|
+
token: ref(0),
|
|
38
|
+
CONST_ITEM_WIDTH: 100,
|
|
39
|
+
CONST_ITEM_HEIGHT: 200,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
_provideData() {
|
|
44
|
+
return metroWidgetH;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
mounted() {},
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div class="rootSize">
|
|
54
|
+
<div :style="{ width: 1280, height: 720, left: 50 }">
|
|
55
|
+
<div
|
|
56
|
+
:style="{
|
|
57
|
+
top: 0,
|
|
58
|
+
width: 200,
|
|
59
|
+
height: 40,
|
|
60
|
+
fontSize: 25,
|
|
61
|
+
lineHeight: '40px',
|
|
62
|
+
color: '#fff753',
|
|
63
|
+
}"
|
|
64
|
+
>
|
|
65
|
+
整页滑动
|
|
66
|
+
</div>
|
|
67
|
+
<div
|
|
68
|
+
:style="{
|
|
69
|
+
top: 50,
|
|
70
|
+
width: CONST_ITEM_WIDTH * 10 + 20,
|
|
71
|
+
height: CONST_ITEM_HEIGHT + 20,
|
|
72
|
+
backgroundColor: '#ff0000',
|
|
73
|
+
}"
|
|
74
|
+
>
|
|
75
|
+
<metro-widget
|
|
76
|
+
name="simpleWidgetHorizontal1"
|
|
77
|
+
:width="CONST_ITEM_WIDTH * 10 + 20"
|
|
78
|
+
:height="CONST_ITEM_HEIGHT + 20"
|
|
79
|
+
:direction="direction"
|
|
80
|
+
:measures="measures"
|
|
81
|
+
:provideData="_provideData"
|
|
82
|
+
:padding="{ top: 10, left: 10, right: 10, bottom: 10 }"
|
|
83
|
+
:enableTouch="true"
|
|
84
|
+
:flingPageWidth="CONST_ITEM_WIDTH * 10"
|
|
85
|
+
>
|
|
86
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
87
|
+
<item
|
|
88
|
+
:data="data"
|
|
89
|
+
:query="query"
|
|
90
|
+
:onEdge="onEdge"
|
|
91
|
+
:onAction="onAction"
|
|
92
|
+
/> </template
|
|
93
|
+
></metro-widget>
|
|
94
|
+
</div>
|
|
95
|
+
<div
|
|
96
|
+
:style="{
|
|
97
|
+
top: CONST_ITEM_HEIGHT + 100,
|
|
98
|
+
width: 200,
|
|
99
|
+
height: 40,
|
|
100
|
+
fontSize: 25,
|
|
101
|
+
lineHeight: '40px',
|
|
102
|
+
color: '#fff753',
|
|
103
|
+
}"
|
|
104
|
+
>
|
|
105
|
+
普通滑动
|
|
106
|
+
</div>
|
|
107
|
+
<div
|
|
108
|
+
:style="{
|
|
109
|
+
top: CONST_ITEM_HEIGHT + 100 + 50,
|
|
110
|
+
width: CONST_ITEM_WIDTH * 10 + 20,
|
|
111
|
+
height: CONST_ITEM_HEIGHT + 20,
|
|
112
|
+
backgroundColor: '#ff0000',
|
|
113
|
+
}"
|
|
114
|
+
>
|
|
115
|
+
<metro-widget
|
|
116
|
+
name="simpleWidgetHorizontal2"
|
|
117
|
+
:width="CONST_ITEM_WIDTH * 10 + 20"
|
|
118
|
+
:height="CONST_ITEM_HEIGHT + 20"
|
|
119
|
+
:direction="direction"
|
|
120
|
+
:measures="measures"
|
|
121
|
+
:provideData="_provideData"
|
|
122
|
+
:padding="{ top: 10, left: 10, right: 10, bottom: 10 }"
|
|
123
|
+
:enableTouch="true"
|
|
124
|
+
>
|
|
125
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
126
|
+
<item
|
|
127
|
+
:data="data"
|
|
128
|
+
:query="query"
|
|
129
|
+
:onEdge="onEdge"
|
|
130
|
+
:onAction="onAction"
|
|
131
|
+
/> </template
|
|
132
|
+
></metro-widget>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<style scoped>
|
|
139
|
+
.rootSize {
|
|
140
|
+
width: 1920;
|
|
141
|
+
height: 1080;
|
|
142
|
+
background-color: #334c4c;
|
|
143
|
+
}
|
|
144
|
+
</style>
|