@shijiu/jsview-vue-samples 2.0.1073 → 2.0.1106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basic/components/div/DivBackground.vue +13 -25
- package/Basic/components/img/ImageGroup.vue +14 -20
- package/Basic/components/img/ImgLayout.vue +59 -68
- package/BasicFocusControl/components/BaseBlock.vue +11 -17
- package/BasicFocusControl/components/MainAreaLeftBlock.vue +2 -2
- package/BasicFocusControl/components/MainAreaRightBlock.vue +2 -2
- package/BasicFocusControl/components/SideBarBlock.vue +2 -2
- package/CssPreprocessor/App.vue +40 -51
- package/CssPreprocessor/Less/App.vue +6 -14
- package/CssPreprocessor/Scss/App.vue +6 -14
- package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +0 -1
- package/CssPreprocessor/Stylus/App.vue +6 -14
- package/CssPreprocessor/utils/ContentBlock.vue +30 -12
- package/CssPreprocessor/utils/ContentList.vue +23 -14
- package/CssPreprocessor/utils/Panel.vue +34 -23
- package/CssPreprocessor/utils/TitleBar.vue +7 -9
- package/DemoHomepage/components/BodyFrame.vue +54 -78
- package/DemoHomepage/components/Dialog.vue +38 -43
- package/DemoHomepage/components/Item.vue +52 -55
- package/DemoHomepage/components/TabFrame.vue +43 -72
- package/DemoHomepage/router.js +1 -1
- package/GiftRain/App.vue +10 -4
- package/GridDemo/App.vue +5 -5
- package/GridDemo/FocusItem.vue +3 -5
- package/GridDemo/Item.vue +4 -24
- package/HashHistory/App.vue +0 -10
- package/HashHistory/views/MainPage.vue +0 -1
- package/ImpactStop/App.vue +0 -1
- package/Input/App.vue +106 -150
- package/Input/FullKeyboard.vue +18 -28
- package/Input/InputPanel.vue +87 -109
- package/Input/KeyboardItem.vue +35 -45
- package/JsvRadarChart/App.vue +16 -19
- package/LongImage/Button.vue +2 -3
- package/LongText/App.vue +0 -3
- package/LongText/Button.vue +0 -1
- package/LongText/LongTextScroll.vue +0 -4
- package/Marquee/App.vue +1 -0
- package/MetroWidgetDemos/PerformanceTest/App.vue +2 -3
- package/MetroWidgetDemos/PerformanceTest/Item.vue +52 -55
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +26 -26
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +86 -95
- package/MetroWidgetDemos/PingPong/App.vue +56 -89
- package/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
- package/MetroWidgetDemos/PingPong/Item.vue +1 -1
- package/MetroWidgetDemos/PingPong/TabItem.vue +3 -3
- package/MetroWidgetDemos/PingPong/WidgetItem.vue +1 -1
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +2 -4
- package/MetroWidgetDemos/basic/Item.vue +1 -1
- package/MetroWidgetDemos/direction/App.vue +0 -2
- package/MetroWidgetDemos/direction/Item.vue +1 -1
- package/MetroWidgetDemos/focusableItemBasic/App.vue +1 -1
- package/MetroWidgetDemos/focusableItemBasic/ButtonItem.vue +1 -1
- package/MetroWidgetDemos/focusableItemMetroWidget/App.vue +1 -1
- package/MetroWidgetDemos/focusableItemMetroWidget/Item.vue +1 -1
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +1 -1
- package/MetroWidgetDemos/focusableItemMix/App.vue +1 -1
- package/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +1 -1
- package/MetroWidgetDemos/focusableItemMix/Item.vue +1 -1
- package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +23 -25
- package/MetroWidgetDemos/layoutType/App.vue +0 -2
- package/MetroWidgetDemos/layoutType/Item.vue +1 -1
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +0 -1
- package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +1 -1
- package/MetroWidgetDemos/padding/App.vue +0 -2
- package/MetroWidgetDemos/padding/Item.vue +1 -1
- package/MetroWidgetDemos/slideSetting/Item.vue +1 -1
- package/MockjsDemo/App.vue +26 -11
- package/MockjsDemo/mock/index.js +9 -1
- package/QrcodeDemo/App.vue +0 -1
- package/SoundPool/App.vue +1 -2
- package/SpriteImage/App.vue +89 -125
- package/Swiper/App.vue +1 -3
- package/TestNativeSharedView/App.vue +104 -48
- package/TextBox/RenderCenter.vue +89 -113
- package/TextBox/RenderLeft.vue +89 -113
- package/TextBox/RenderOneLine.vue +7 -10
- package/TextBox/RenderRight.vue +8 -11
- package/TextShadowDemo/App.vue +54 -75
- package/TextureAnimation/App.vue +175 -287
- package/TextureAnimation/App2.vue +1 -5
- package/ThrowMoveDemo/AccelerateDemo.vue +40 -71
- package/ThrowMoveDemo/App.vue +13 -23
- package/ThrowMoveDemo/TargetDemo.vue +24 -53
- package/ThrowMoveDemo/UDParabolicDemo.vue +31 -60
- package/VideoDemo/App.vue +71 -116
- package/package.json +1 -1
- package/VideoDemo/components/Button.vue +0 -58
- package/VideoDemo/components/Controllor.vue +0 -197
- package/VideoDemo/components/VideoFrame.vue +0 -140
package/ThrowMoveDemo/App.vue
CHANGED
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-10-20 18:27:08
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: ZhengYi
|
|
5
|
+
* @LastEditTime: 2023-05-05
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
<script>
|
|
8
|
+
<script setup>
|
|
9
9
|
import LRParabolicDemo from "./LRParabolicDemo.vue";
|
|
10
10
|
import UDParabolicDemo from "./UDParabolicDemo.vue";
|
|
11
11
|
import TargetDemo from "./TargetDemo.vue";
|
|
12
12
|
import AccelerateDemo from "./AccelerateDemo.vue";
|
|
13
|
+
import { shallowRef } from "vue"
|
|
14
|
+
import { useRouter } from "vue-router"
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
TargetDemo,
|
|
19
|
-
AccelerateDemo,
|
|
20
|
-
},
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
demoIndex: 0,
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
methods: {
|
|
27
|
-
onKeyDown(ev) {
|
|
16
|
+
const router=useRouter()
|
|
17
|
+
let demoIndex=shallowRef(0)
|
|
18
|
+
|
|
19
|
+
const onKeyDown=(ev)=>{
|
|
28
20
|
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
29
|
-
|
|
21
|
+
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
30
22
|
return true;
|
|
31
23
|
}
|
|
32
24
|
if (ev.keyCode === 37) {
|
|
33
|
-
|
|
25
|
+
demoIndex.value = demoIndex.value - 1 < 0 ? 3 : demoIndex.value - 1;
|
|
34
26
|
} else if (ev.keyCode === 39) {
|
|
35
|
-
|
|
27
|
+
demoIndex.value = demoIndex.value + 1 > 3 ? 0 : demoIndex.value + 1;
|
|
36
28
|
}
|
|
37
29
|
return true;
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
};
|
|
30
|
+
}
|
|
41
31
|
</script>
|
|
42
32
|
|
|
43
33
|
<template>
|
|
@@ -1,44 +1,31 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-10-20 18:27:25
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: ZhengYi
|
|
5
|
+
* @LastEditTime: 2023-05-05
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
<script>
|
|
8
|
+
<script setup>
|
|
9
9
|
import { JsvActorMoveControl, JsvActorMove } from "jsview";
|
|
10
|
+
import { shallowRef } from "vue";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
data() {
|
|
19
|
-
return {
|
|
20
|
-
direction: 1,
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
setup() {
|
|
24
|
-
let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
|
|
25
|
-
let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
name: String,
|
|
14
|
+
})
|
|
15
|
+
let direction = shallowRef(1)
|
|
16
|
+
let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
|
|
17
|
+
let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
|
|
18
|
+
let focusNode=shallowRef(null)
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
throwControl,
|
|
29
|
-
moveControl,
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
onKeyDown(ev) {
|
|
20
|
+
const onKeyDown=(ev)=>{
|
|
34
21
|
if (ev.keyCode === 13) {
|
|
35
|
-
let preDirection =
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
let preDirection = direction.value;
|
|
23
|
+
direction.value = -direction.value;
|
|
24
|
+
moveControl.moveToX(195 * direction.value, 250, (x, y) => {
|
|
38
25
|
console.log(`Move end with x=${x} y=${y}`);
|
|
39
26
|
});
|
|
40
27
|
const position = (-100 * preDirection) / 2;
|
|
41
|
-
|
|
28
|
+
throwControl.throwAlongY(
|
|
42
29
|
-500 * preDirection,
|
|
43
30
|
750 * preDirection,
|
|
44
31
|
{
|
|
@@ -53,40 +40,24 @@ export default {
|
|
|
53
40
|
return true;
|
|
54
41
|
}
|
|
55
42
|
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
};
|
|
43
|
+
}
|
|
44
|
+
|
|
59
45
|
</script>
|
|
60
46
|
|
|
61
47
|
<template>
|
|
62
|
-
<jsv-focus-block
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
>
|
|
48
|
+
<jsv-focus-block ref="focusNode" :name="props.name" autoFocus :onAction="{
|
|
49
|
+
onKeyDown: onKeyDown,
|
|
50
|
+
}">
|
|
51
|
+
<div key="sample1" class="detail-font" :style="{ top: 150, left: 425, width: 430, height: 40 }">
|
|
75
52
|
拐点前触碰目标点
|
|
76
53
|
</div>
|
|
77
|
-
<div
|
|
78
|
-
key="DirectText"
|
|
79
|
-
class="font"
|
|
80
|
-
:style="{ top: 250, left: 425, width: 430, height: 40 }"
|
|
81
|
-
>
|
|
54
|
+
<div key="DirectText" class="font" :style="{ top: 250, left: 425, width: 430, height: 40 }">
|
|
82
55
|
{{ `当前方向:${direction > 0 ? "右" : "左"}` }}
|
|
83
56
|
</div>
|
|
84
57
|
<div :style="{ top: 590, left: 625 }">
|
|
85
58
|
<jsv-actor-move key="move" :control="moveControl">
|
|
86
59
|
<jsv-actor-move key="throw" :control="throwControl">
|
|
87
|
-
<div
|
|
88
|
-
:style="{ backgroundColor: '#0916ff', width: 30, height: 30 }"
|
|
89
|
-
></div>
|
|
60
|
+
<div :style="{ backgroundColor: '#0916ff', width: 30, height: 30 }"></div>
|
|
90
61
|
</jsv-actor-move>
|
|
91
62
|
</jsv-actor-move>
|
|
92
63
|
</div>
|
|
@@ -1,49 +1,36 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-10-20 18:27:25
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: ZhengYi
|
|
5
|
+
* @LastEditTime: 2023-05-05
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
<script>
|
|
8
|
+
<script setup>
|
|
9
9
|
import { JsvActorMoveControl, JsvActorMove } from "jsview";
|
|
10
|
+
import { shallowRef, computed } from "vue";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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(); // 平移运动体控制器
|
|
12
|
+
let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
|
|
13
|
+
let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
|
|
14
|
+
let focusNode=shallowRef(null)
|
|
34
15
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
name: String,
|
|
18
|
+
})
|
|
19
|
+
let direction = shallowRef(1)
|
|
20
|
+
|
|
21
|
+
const directionDetail = computed(() => {
|
|
22
|
+
return direction.value < 0 ? "上" : "下";
|
|
23
|
+
})
|
|
24
|
+
const detail = computed(() => {
|
|
25
|
+
return direction.value < 0 ? "向上抛物" : "向下掷物并弹起";
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const onKeyDown=(ev)=>{
|
|
29
|
+
let preDirection = direction.value;
|
|
43
30
|
switch (ev.keyCode) {
|
|
44
31
|
case 13:
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
direction.value = -direction.value;
|
|
33
|
+
throwControl.throwAlongY(
|
|
47
34
|
-400 * preDirection,
|
|
48
35
|
550 * preDirection,
|
|
49
36
|
{
|
|
@@ -58,40 +45,24 @@ export default {
|
|
|
58
45
|
return true;
|
|
59
46
|
}
|
|
60
47
|
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
};
|
|
48
|
+
}
|
|
49
|
+
|
|
64
50
|
</script>
|
|
65
51
|
|
|
66
52
|
<template>
|
|
67
|
-
<jsv-focus-block
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
>
|
|
53
|
+
<jsv-focus-block ref="focusNode" :name="props.name" autoFocus :onAction="{
|
|
54
|
+
onKeyDown: onKeyDown,
|
|
55
|
+
}">
|
|
56
|
+
<div key="sample1" class="detail-font" :style="{ top: 150, left: 425, width: 430, height: 40 }">
|
|
80
57
|
{{ detail }}
|
|
81
58
|
</div>
|
|
82
|
-
<div
|
|
83
|
-
key="DirectText"
|
|
84
|
-
class="font"
|
|
85
|
-
:style="{ top: 250, left: 425, width: 430, height: 40 }"
|
|
86
|
-
>
|
|
59
|
+
<div key="DirectText" class="font" :style="{ top: 250, left: 425, width: 430, height: 40 }">
|
|
87
60
|
{{ `当前方向:${directionDetail}` }}
|
|
88
61
|
</div>
|
|
89
62
|
<div :style="{ top: 590, left: 625 }">
|
|
90
63
|
<jsv-actor-move key="move" :control="moveControl">
|
|
91
64
|
<jsv-actor-move key="throw" :control="throwControl">
|
|
92
|
-
<div
|
|
93
|
-
:style="{ backgroundColor: '#ffb915', width: 30, height: 30 }"
|
|
94
|
-
></div>
|
|
65
|
+
<div :style="{ backgroundColor: '#ffb915', width: 30, height: 30 }"></div>
|
|
95
66
|
</jsv-actor-move>
|
|
96
67
|
</jsv-actor-move>
|
|
97
68
|
</div>
|
package/VideoDemo/App.vue
CHANGED
|
@@ -1,121 +1,76 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ZhengYi
|
|
3
|
+
* @Date: 2023-05-06
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
1
6
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"3.支持平移、缩放、旋转等动画\n" +
|
|
13
|
-
"4.支持ObjectFit调整\n",
|
|
14
|
-
normalVideo:
|
|
15
|
-
"名称:Video\n" +
|
|
16
|
-
"功能描述:\n" +
|
|
17
|
-
"1.视频播放、支持前进/后退控制\n" +
|
|
18
|
-
"2.支持ObjectFit调整\n",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
let caption = shallowRef(null);
|
|
22
|
-
let useTexture = shallowRef(null);
|
|
23
|
-
let videoTime = reactive({
|
|
24
|
-
currentTime: 0,
|
|
25
|
-
duration: 0,
|
|
26
|
-
});
|
|
27
|
-
let objectFitTitle = shallowRef(null);
|
|
28
|
-
let playStatus = ref("");
|
|
29
|
-
provide("useTexture", useTexture);
|
|
30
|
-
provide("objectFit", shallowRef(null));
|
|
31
|
-
provide("videoRect", ref({}));
|
|
32
|
-
provide("playVideo", shallowRef(null));
|
|
33
|
-
provide("seekVideo", shallowRef(null));
|
|
34
|
-
provide("enableAnimation", shallowRef(null));
|
|
35
|
-
provide("videoTime", videoTime);
|
|
36
|
-
provide("objectFitTitle", objectFitTitle);
|
|
37
|
-
provide("playStatus", playStatus);
|
|
38
|
-
watch(useTexture, () => {
|
|
39
|
-
caption.value = useTexture.value ? Caption.offscreenVideo : Caption.normalVideo;
|
|
40
|
-
});
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<template>
|
|
44
|
-
<div
|
|
45
|
-
:style="{
|
|
46
|
-
top: 0,
|
|
47
|
-
left: 0,
|
|
48
|
-
width: 1280,
|
|
49
|
-
height: 720,
|
|
50
|
-
backgroundColor: 'rgb(222,211,140)',
|
|
51
|
-
}"
|
|
52
|
-
>
|
|
53
|
-
<!-- :key="useTexture" => 当useTexture属性变化时,重建VideoFrame -->
|
|
54
|
-
<VideoFrame :key="useTexture" />
|
|
55
|
-
|
|
56
|
-
<!-- :key="useTexture" => JsView bug,当useTexture属性变化时,为了保证显示在VideoFrame前面 -->
|
|
57
|
-
<div class="caption" :key="useTexture">
|
|
58
|
-
{{ caption }}
|
|
59
|
-
</div>
|
|
60
|
-
<div>
|
|
61
|
-
<div class="text status">
|
|
62
|
-
{{ "播放状态: " + playStatus }}
|
|
63
|
-
</div>
|
|
64
|
-
<div class="text objectFit">
|
|
65
|
-
{{ objectFitTitle }}
|
|
66
|
-
</div>
|
|
67
|
-
<div class="text current">
|
|
68
|
-
{{ Math.ceil(videoTime.currentTime) }}
|
|
69
|
-
</div>
|
|
70
|
-
<div class="text duration">
|
|
71
|
-
{{ "/" + Math.ceil(videoTime.duration) }}
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
<Controllor class="controllor" />
|
|
75
|
-
</div>
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<style scoped>
|
|
79
|
-
.caption {
|
|
80
|
-
text-align: left;
|
|
81
|
-
font-size: 24;
|
|
82
|
-
line-height: 30;
|
|
83
|
-
color: #ffffff;
|
|
84
|
-
left: 10;
|
|
85
|
-
top: 10;
|
|
86
|
-
width: 400;
|
|
87
|
-
height: 180;
|
|
88
|
-
background-color: rgba(27, 38, 151, 0.8);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.text {
|
|
92
|
-
color: #ff0000;
|
|
93
|
-
font-size: 24;
|
|
94
|
-
top: 550;
|
|
95
|
-
width: 60;
|
|
96
|
-
height: 40;
|
|
7
|
+
import { shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
8
|
+
import { JsvPlayer } from "jsview"
|
|
9
|
+
import { useRouter } from "vue-router";
|
|
10
|
+
//路由
|
|
11
|
+
const router = useRouter()
|
|
12
|
+
//位移变量
|
|
13
|
+
let leftMove = shallowRef(0)
|
|
14
|
+
//定时器
|
|
15
|
+
let timer = {
|
|
16
|
+
id: -1
|
|
97
17
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
18
|
+
//动画
|
|
19
|
+
const changeTransition = () => {
|
|
20
|
+
let transition = "left 0.5s"
|
|
21
|
+
return transition
|
|
101
22
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
23
|
+
//挂载时启动定时器
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
timer.id = setInterval(() => {
|
|
26
|
+
if (leftMove.value > (1280-350)) {
|
|
27
|
+
leftMove.value = -60
|
|
28
|
+
}
|
|
29
|
+
leftMove.value = leftMove.value + 60
|
|
30
|
+
}, 500)
|
|
31
|
+
})
|
|
32
|
+
onBeforeUnmount(() => {
|
|
33
|
+
if (timer.id > 0) {
|
|
34
|
+
clearInterval(timer.id)
|
|
35
|
+
timer.id = -1;
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
//设定视频来源
|
|
39
|
+
const video_url =
|
|
40
|
+
"http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
|
|
41
|
+
//按键事件
|
|
42
|
+
const onKeyDown = (ev) => {
|
|
43
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
44
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
106
47
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
text-align: right;
|
|
48
|
+
//注册事件
|
|
49
|
+
let actionDefines = {
|
|
50
|
+
onKeyDown
|
|
111
51
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
52
|
+
</script>
|
|
53
|
+
<template>
|
|
54
|
+
<jsv-focus-block autoFocus :onAction="actionDefines">
|
|
55
|
+
<div :style="{ width: 700, height: 500, top: 60, left: leftMove, transition: changeTransition() }">
|
|
56
|
+
<JsvPlayer :src="video_url" autoplay="autoplay" loop="loop" :style="{
|
|
57
|
+
top: 0,
|
|
58
|
+
left: 0,
|
|
59
|
+
width: 700,
|
|
60
|
+
height: 500,
|
|
61
|
+
}"></JsvPlayer>
|
|
62
|
+
</div>
|
|
63
|
+
<div :style="{
|
|
64
|
+
textAlign: 'center',
|
|
65
|
+
fontSize: 30,
|
|
66
|
+
lineHeight: 50,
|
|
67
|
+
color: '#ffffff',
|
|
68
|
+
left: 100,
|
|
69
|
+
top: 620,
|
|
70
|
+
width: 1280 - 200,
|
|
71
|
+
height: 50,
|
|
72
|
+
backgroundColor: 'rgba(27,38,151,0.8)'
|
|
73
|
+
}">观察视频在移动过程中是否正常播放,特别是在出屏幕一半时。</div>
|
|
74
|
+
</jsv-focus-block>
|
|
75
|
+
</template>
|
|
76
|
+
<style></style>
|
package/package.json
CHANGED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
const props = defineProps({
|
|
4
|
-
style: Object,
|
|
5
|
-
autoFocus: Boolean,
|
|
6
|
-
name: String,
|
|
7
|
-
onClick: Function,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const hasFocused = ref(false);
|
|
11
|
-
|
|
12
|
-
const onFocus = () => {
|
|
13
|
-
hasFocused.value = true;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const onBlur = () => {
|
|
17
|
-
hasFocused.value = false;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const onKeyDown = (ev) => {
|
|
21
|
-
if (ev.keyCode === 13) {
|
|
22
|
-
// Enter
|
|
23
|
-
props.onClick?.();
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<jsv-focus-block
|
|
32
|
-
:name="name"
|
|
33
|
-
:autoFocus="autoFocus ? '' : undefined"
|
|
34
|
-
:onAction="{
|
|
35
|
-
onFocus: onFocus,
|
|
36
|
-
onBlur: onBlur,
|
|
37
|
-
onKeyDown: onKeyDown,
|
|
38
|
-
}"
|
|
39
|
-
>
|
|
40
|
-
<div
|
|
41
|
-
class="item"
|
|
42
|
-
:style="{
|
|
43
|
-
...style,
|
|
44
|
-
backgroundColor: hasFocused ? '#FFFF00' : '#A8A8A8',
|
|
45
|
-
}"
|
|
46
|
-
>
|
|
47
|
-
<slot></slot>
|
|
48
|
-
</div>
|
|
49
|
-
</jsv-focus-block>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<style scoped>
|
|
53
|
-
.item {
|
|
54
|
-
text-align: center;
|
|
55
|
-
font-size: 24;
|
|
56
|
-
line-height: 40;
|
|
57
|
-
}
|
|
58
|
-
</style>
|