@shijiu/jsview-vue 0.9.631 → 0.9.766
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -0
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/jsv-engine-js-browser.js +6 -0
- package/dom/target_core_revision.js +4 -4
- package/loader/loader.js +4 -0
- package/package.json +1 -1
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +1 -1
- package/samples/AnimPicture/App.vue +5 -5
- package/samples/Basic/components/div/DivLayout.vue +1 -1
- package/samples/Basic/components/img/ImageGroup.vue +2 -2
- package/samples/Basic/components/img/ImgLayout.vue +79 -15
- package/samples/Basic/components/text/TextDirection.vue +104 -0
- package/samples/Basic/components/text/TextEmoji.vue +1 -1
- package/samples/Basic/components/text/TextGroup1.vue +1 -1
- package/samples/Basic/components/text/TextGroup2.vue +11 -1
- package/samples/Basic/components/text/TextOverflow.vue +8 -3
- package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
- package/samples/Collision/App.vue +11 -11
- package/samples/DemoHomepage/App.vue +43 -8
- package/samples/DemoHomepage/router.js +18 -10
- package/samples/DemoHomepage/views/Homepage.vue +83 -96
- package/samples/FilterDemo/App.vue +1 -1
- package/samples/FlipCard/App.vue +2 -2
- package/samples/FlipCard/FlipCard.vue +3 -3
- package/samples/GridDemo/App.vue +3 -3
- package/samples/GridDemo/ButtonBlock.vue +2 -2
- package/samples/GridDemo/FocusItem.vue +2 -2
- package/samples/GridDemo/Item.vue +1 -1
- package/samples/HashHistory/App.vue +10 -3
- package/samples/HashHistory/components/Item.vue +1 -1
- package/samples/ImpactStop/App.vue +15 -11
- package/samples/Input/InputPanel.vue +1 -1
- package/samples/LongImage/Button.vue +1 -1
- package/samples/LongImage/ButtonItem.vue +1 -1
- package/samples/LongImage/LongImageScroll.vue +2 -2
- package/samples/LongText/App.vue +1 -1
- package/samples/LongText/Button.vue +1 -1
- package/samples/LongText/ButtonItem.vue +1 -1
- package/samples/LongText/LongTextScroll.vue +3 -3
- package/samples/Marquee/App.vue +176 -40
- package/samples/Marquee/longText.js +14 -0
- package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +4 -4
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
- package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +82 -0
- package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +88 -0
- package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Item.vue +4 -2
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +2 -2
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +1 -1
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +3 -3
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +6 -6
- package/samples/MetroWidgetDemos/WidgetItem.vue +2 -3
- package/samples/MetroWidgetDemos/data.js +2 -1
- package/samples/NinePatchDemo/App.vue +2 -2
- package/samples/NinePatchDemo/Item.vue +2 -2
- package/samples/Preload/App.vue +1 -1
- package/samples/Preload/Item.vue +1 -1
- package/samples/QrcodeDemo/App.vue +1 -1
- package/samples/ScaleDownNeon/App.vue +107 -0
- package/samples/SoundPool/App.vue +3 -3
- package/samples/SpriteImage/App.vue +5 -0
- package/samples/TextBox/App.vue +9 -82
- package/samples/TextBox/RenderCenter.vue +40 -16
- package/samples/TextBox/RenderLeft.vue +48 -19
- package/samples/TextBox/RenderOneLine.vue +30 -49
- package/samples/TextBox/RenderRight.vue +40 -16
- package/samples/TextShadowDemo/App.vue +11 -17
- package/samples/TextureAnimation/App2.vue +1 -1
- package/samples/TextureSize/App.vue +3 -3
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +33 -47
- package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TransitPage/App.vue +1 -1
- package/samples/VideoDemo/App.vue +8 -8
- package/samples/VideoDemo/components/Button.vue +1 -1
- package/samples/VideoDemo/components/Controllor.vue +1 -1
- package/samples/VisibleSensorDemo/App.vue +3 -3
- package/scripts/jsview-run-android.js +5 -4
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +4 -4
- package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +245 -111
- package/utils/JsViewEngineWidget/TemplateParser.js +227 -178
- package/utils/JsViewEngineWidget/WidgetCommon.js +14 -6
- package/utils/JsViewEngineWidget/index.js +3 -2
- package/utils/JsViewPlugin/BrowserPluginLoader.js +4 -2
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +302 -0
- package/utils/JsViewPlugin/JsvAudio/CheckType.js +68 -0
- package/utils/JsViewPlugin/JsvAudio/Events.js +17 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +176 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.js +40 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +46 -0
- package/utils/JsViewPlugin/JsvAudio/PluginLoader.js +140 -0
- package/utils/JsViewPlugin/JsvAudio/index.js +26 -0
- package/utils/JsViewPlugin/JsvAudio/version.js +24 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +61 -12
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +8 -1
- package/utils/JsViewPlugin/JsvPlayer/index.js +14 -0
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvHashHistory.js +34 -8
- package/utils/JsViewVueTools/JsvImpactTracer.js +2 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +46 -8
- package/utils/JsViewVueTools/JsvStyleClass.js +9 -0
- package/utils/JsViewVueTools/JsvTextTools.js +18 -0
- package/utils/JsViewVueTools/TypeCheckAndSet.js +3 -3
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +5 -7
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +20 -22
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +4 -4
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -9
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +1 -1
- package/utils/JsViewVueWidget/JsvMarquee.vue +188 -205
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
- package/utils/JsViewVueWidget/JsvNinePatch.vue +63 -54
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +10 -5
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +2 -2
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +21 -5
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +23 -3
- package/utils/JsViewVueWidget/JsvTextBox.vue +27 -84
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +5 -6
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +5 -5
- package/utils/JsViewVueWidget/index.js +8 -8
- package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
- package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
- package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
- package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
- package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
- package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
|
@@ -2,21 +2,46 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-07-11 13:31:36
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-02 15:35:12
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import {
|
|
10
|
+
MetroWidget,
|
|
11
|
+
VERTICAL,
|
|
12
|
+
EdgeDirection,
|
|
13
|
+
JsvNinePatch,
|
|
14
|
+
useFocusHub,
|
|
15
|
+
} from "jsview";
|
|
16
|
+
import { advanceMetroWidget } from "../../data";
|
|
17
|
+
import WidgetItem from "../widgets/WidgetItem.vue";
|
|
18
|
+
import focusImg from "./focus1.png";
|
|
19
|
+
import { ref, shallowRef, reactive, provide } from "vue";
|
|
13
20
|
|
|
14
|
-
const
|
|
21
|
+
const focusHub = useFocusHub();
|
|
22
|
+
const showFocus = ref(false);
|
|
15
23
|
|
|
16
|
-
//item为Widgetitem的一些回调
|
|
17
24
|
const provideData = () => {
|
|
18
25
|
return advanceMetroWidget;
|
|
19
26
|
};
|
|
27
|
+
|
|
28
|
+
const onFocus = () => {
|
|
29
|
+
console.log("testtest", " widget onfocus");
|
|
30
|
+
showFocus.value = true;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const onBlur = () => {
|
|
34
|
+
showFocus.value = false;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const focusSize = reactive({
|
|
38
|
+
width: 0,
|
|
39
|
+
height: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
top: 0,
|
|
42
|
+
});
|
|
43
|
+
provide("focusSize", focusSize);
|
|
44
|
+
|
|
20
45
|
// measures中会返回doSlide: false, 既MetroWidget自身不处理滚动, 滚动由子的sendFocusRectEvent控制
|
|
21
46
|
const measures = (item) => {
|
|
22
47
|
return {
|
|
@@ -29,7 +54,7 @@ const measures = (item) => {
|
|
|
29
54
|
};
|
|
30
55
|
const onEdge = (edgeInfo) => {
|
|
31
56
|
if (edgeInfo.direction == EdgeDirection.left) {
|
|
32
|
-
|
|
57
|
+
focusHub.setFocus("mwButton");
|
|
33
58
|
}
|
|
34
59
|
};
|
|
35
60
|
</script>
|
|
@@ -38,7 +63,7 @@ const onEdge = (edgeInfo) => {
|
|
|
38
63
|
<div
|
|
39
64
|
:style="{
|
|
40
65
|
left: 500,
|
|
41
|
-
top:
|
|
66
|
+
top: 20,
|
|
42
67
|
width: 500,
|
|
43
68
|
height: 400,
|
|
44
69
|
fontSize: 30,
|
|
@@ -47,16 +72,20 @@ const onEdge = (edgeInfo) => {
|
|
|
47
72
|
>
|
|
48
73
|
{{ `进一步, MetroWidget的item\n可以是包含MetroWidget的组件` }}
|
|
49
74
|
</div>
|
|
75
|
+
<!-- 为了保证边缘的item缩放后依旧完整显示, 需要设置padding, 注意width/height是包含padding的 -->
|
|
50
76
|
<metro-widget
|
|
51
77
|
name="mwWidget"
|
|
52
|
-
:top="
|
|
78
|
+
:top="100"
|
|
53
79
|
:left="400"
|
|
54
80
|
:provideData="provideData"
|
|
55
|
-
:width="
|
|
81
|
+
:width="660"
|
|
56
82
|
:height="600"
|
|
83
|
+
:padding="{ left: 30, right: 30 }"
|
|
57
84
|
:direction="VERTICAL"
|
|
58
85
|
:measures="measures"
|
|
59
86
|
:onEdge="onEdge"
|
|
87
|
+
:onFocus="onFocus"
|
|
88
|
+
:onBlur="onBlur"
|
|
60
89
|
>
|
|
61
90
|
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口, onItemEdge则是item内部焦点处理到达边缘后, 需要通知MetroWidget时的回调 -->
|
|
62
91
|
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
@@ -68,4 +97,20 @@ const onEdge = (edgeInfo) => {
|
|
|
68
97
|
/>
|
|
69
98
|
</template>
|
|
70
99
|
</metro-widget>
|
|
100
|
+
<jsv-nine-patch
|
|
101
|
+
v-show="showFocus"
|
|
102
|
+
:style="{
|
|
103
|
+
width: focusSize.width,
|
|
104
|
+
height: focusSize.height,
|
|
105
|
+
top: focusSize.top,
|
|
106
|
+
left: focusSize.left,
|
|
107
|
+
}"
|
|
108
|
+
:imageUrl="focusImg"
|
|
109
|
+
:imageWidth="55"
|
|
110
|
+
:centerWidth="1"
|
|
111
|
+
:borderOutset="13"
|
|
112
|
+
:imageDspWidth="55"
|
|
113
|
+
:animTime="0.2"
|
|
114
|
+
:waitForInit="true"
|
|
115
|
+
></jsv-nine-patch>
|
|
71
116
|
</template>
|
|
Binary file
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-05-10 15:21:24
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-12-02 16:12:43
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
|
-
import { ref } from "vue";
|
|
9
|
+
import { ref, shallowRef, inject } from "vue";
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
data: Object,
|
|
@@ -14,6 +14,7 @@ const props = defineProps({
|
|
|
14
14
|
onAction: Object,
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
const divRef = shallowRef(null);
|
|
17
18
|
const focused = ref(false);
|
|
18
19
|
|
|
19
20
|
// 自身的焦点状态自己记录, 通过回调来改变
|
|
@@ -53,6 +54,7 @@ props.onAction.register("onClick", onClick);
|
|
|
53
54
|
}"
|
|
54
55
|
></div>
|
|
55
56
|
<div
|
|
57
|
+
ref="divRef"
|
|
56
58
|
:style="{
|
|
57
59
|
width: data.width,
|
|
58
60
|
height: data.height,
|
|
@@ -76,7 +76,7 @@ import { data1, data2, data3 } from "./data";
|
|
|
76
76
|
import borderImgPath from "./border.png";
|
|
77
77
|
import Item from "./components/ContentItem.vue";
|
|
78
78
|
import MyTab from "./components/MyTab.vue";
|
|
79
|
-
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
79
|
+
import { ref, shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
80
80
|
import { useRouter } from "vue-router";
|
|
81
81
|
import {
|
|
82
82
|
VERTICAL,
|
|
@@ -90,7 +90,7 @@ const router = useRouter();
|
|
|
90
90
|
const focusHub = useFocusHub();
|
|
91
91
|
let contentData = data1;
|
|
92
92
|
let requestDataTime = 0;
|
|
93
|
-
const mwRef =
|
|
93
|
+
const mwRef = shallowRef(null);
|
|
94
94
|
|
|
95
95
|
const onKeyDown = (ev) => {
|
|
96
96
|
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
@@ -127,7 +127,7 @@ const onItemFocus = (id) => {
|
|
|
127
127
|
clearTimeout(requestDataTime);
|
|
128
128
|
requestDataTime = 0;
|
|
129
129
|
}
|
|
130
|
-
requestDataTime = setTimeout(() => {
|
|
130
|
+
// requestDataTime = setTimeout(() => {
|
|
131
131
|
switch (id) {
|
|
132
132
|
case 0:
|
|
133
133
|
contentData = data1;
|
|
@@ -140,7 +140,7 @@ const onItemFocus = (id) => {
|
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
142
142
|
mwRef.value?.refreshData(true);
|
|
143
|
-
}, 0);
|
|
143
|
+
// }, 0);
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
onBeforeUnmount(() => {
|
|
@@ -13,7 +13,7 @@ import couponMid from "../assets/coupon_mid.png";
|
|
|
13
13
|
import borderLeft from "../assets/line_left.png";
|
|
14
14
|
import borderMid from "../assets/line_mid.png";
|
|
15
15
|
import borderRight from "../assets/line_right.png";
|
|
16
|
-
import { ref, computed } from "vue";
|
|
16
|
+
import { ref, shallowRef, computed } from "vue";
|
|
17
17
|
|
|
18
18
|
const props = defineProps({
|
|
19
19
|
data: Object,
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-09-29 16:13:35
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2022-12-02 16:14:11
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
|
-
import { ref } from "vue";
|
|
9
|
+
import { ref, shallowRef } from "vue";
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
props: {
|
|
13
|
-
name:
|
|
13
|
+
name: String,
|
|
14
14
|
onEdgeDown: Function,
|
|
15
15
|
onItemFocus: Function,
|
|
16
16
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<script setup>
|
|
9
9
|
import { VERTICAL, MetroWidget } from "jsview";
|
|
10
10
|
import WidgetItem from "../WidgetItem.vue";
|
|
11
|
-
import { ref, watch, onBeforeUnmount } from "vue";
|
|
11
|
+
import { ref, shallowRef, watch, onBeforeUnmount } from "vue";
|
|
12
12
|
|
|
13
13
|
const props = defineProps({
|
|
14
14
|
data: {
|
|
@@ -24,7 +24,7 @@ const props = defineProps({
|
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const widgetRef =
|
|
27
|
+
const widgetRef = shallowRef(null);
|
|
28
28
|
|
|
29
29
|
const provideData = () => {
|
|
30
30
|
return props.data.data;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<script>
|
|
9
9
|
import AppPage from "./AppPage.vue";
|
|
10
10
|
import { getKeyFramesGroup } from "jsview";
|
|
11
|
-
import { reactive, ref } from "vue";
|
|
11
|
+
import { reactive, ref, shallowRef } from "vue";
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
components: {
|
|
@@ -187,7 +187,7 @@ export default {
|
|
|
187
187
|
animation: page0Anim.anim,
|
|
188
188
|
animationFillMode: 'forwards',
|
|
189
189
|
}"
|
|
190
|
-
|
|
190
|
+
@animationend="page0Anim.onend"
|
|
191
191
|
>
|
|
192
192
|
<app-page
|
|
193
193
|
v-if="page0Show"
|
|
@@ -201,7 +201,7 @@ export default {
|
|
|
201
201
|
animation: page1Anim.anim,
|
|
202
202
|
animationFillMode: 'forwards',
|
|
203
203
|
}"
|
|
204
|
-
|
|
204
|
+
@animationend="page1Anim.onend"
|
|
205
205
|
>
|
|
206
206
|
<app-page
|
|
207
207
|
v-if="page1Show"
|
|
@@ -10,7 +10,7 @@ import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
|
10
10
|
import { useFocusHub } from "jsview";
|
|
11
11
|
import { simpleDataAbs } from "../data";
|
|
12
12
|
import Item from "../Item.vue";
|
|
13
|
-
const
|
|
13
|
+
const focusHub = useFocusHub();
|
|
14
14
|
|
|
15
15
|
const wholePageSlide = new WholePageSlide();
|
|
16
16
|
|
|
@@ -29,7 +29,7 @@ const measuresAbs = (item) => {
|
|
|
29
29
|
};
|
|
30
30
|
const onEdgeAbs = (edgeInfo) => {
|
|
31
31
|
if (edgeInfo.direction == EdgeDirection.left) {
|
|
32
|
-
|
|
32
|
+
focusHub.setFocus("mw");
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
</script>
|
|
@@ -13,10 +13,10 @@ import AbsoluteTemplate from "./AbsoluteTemplate.vue";
|
|
|
13
13
|
import RelativeTemplate from "./RelativeTemplate.vue";
|
|
14
14
|
|
|
15
15
|
const router = useRouter();
|
|
16
|
-
const
|
|
16
|
+
const focusHub = useFocusHub();
|
|
17
17
|
|
|
18
18
|
const onFocus = () => {
|
|
19
|
-
|
|
19
|
+
focusHub.setFocus("button");
|
|
20
20
|
};
|
|
21
21
|
const onKeyDown = (ev) => {
|
|
22
22
|
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
9
|
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { ref } from "vue";
|
|
10
|
+
import { ref, shallowRef } from "vue";
|
|
11
11
|
import { useFocusHub } from "jsview";
|
|
12
12
|
import { simpleData } from "../data";
|
|
13
13
|
import Item from "../Item.vue";
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const mwRef =
|
|
15
|
+
const focusHub = useFocusHub();
|
|
16
|
+
const mwRef = shallowRef(null);
|
|
17
17
|
|
|
18
18
|
const wholePageSlide = new WholePageSlide();
|
|
19
19
|
let innerData = simpleData.concat();
|
|
@@ -34,9 +34,9 @@ const onEdge = (edgeInfo) => {
|
|
|
34
34
|
// MetroWidget焦点到达边缘后的回调
|
|
35
35
|
if (edgeInfo.direction == EdgeDirection.top) {
|
|
36
36
|
buttonFocus.value = true;
|
|
37
|
-
|
|
37
|
+
focusHub.setFocus("button");
|
|
38
38
|
} else if (edgeInfo.direction == EdgeDirection.right) {
|
|
39
|
-
|
|
39
|
+
focusHub.setFocus("mwAbs");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -45,7 +45,7 @@ const buttonOnKeyDown = (ev) => {
|
|
|
45
45
|
switch (ev.keyCode) {
|
|
46
46
|
case 40:
|
|
47
47
|
buttonFocus.value = false;
|
|
48
|
-
|
|
48
|
+
focusHub.setFocus("mw");
|
|
49
49
|
return true;
|
|
50
50
|
case 13:
|
|
51
51
|
if (innerData.length == simpleData.length) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
<script setup>
|
|
3
3
|
import { HORIZONTAL, MetroWidget, useFocusHub } from "jsview";
|
|
4
|
-
import { ref } from "vue";
|
|
4
|
+
import { ref, shallowRef } from "vue";
|
|
5
5
|
import Item from "./Item.vue";
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
@@ -11,7 +11,7 @@ const props = defineProps({
|
|
|
11
11
|
onAction: Object,
|
|
12
12
|
});
|
|
13
13
|
const focusHub = useFocusHub();
|
|
14
|
-
const mwRef =
|
|
14
|
+
const mwRef = shallowRef(null);
|
|
15
15
|
|
|
16
16
|
const measures = (item) => {
|
|
17
17
|
return item;
|
|
@@ -78,7 +78,6 @@ props.onAction.register("onBlur", onBlur);
|
|
|
78
78
|
bottom: 10,
|
|
79
79
|
}"
|
|
80
80
|
:measures="measures"
|
|
81
|
-
:slideSetting="seamlessSlide"
|
|
82
81
|
:onEdge="onItemEdge"
|
|
83
82
|
:sendFocusRectEvent="true"
|
|
84
83
|
>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-07-11 14:00:33
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-02 15:23:08
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -177,6 +177,7 @@ for (let i = 0; i < 10; i++) {
|
|
|
177
177
|
height: 170,
|
|
178
178
|
name: "widget_" + i,
|
|
179
179
|
marginBottom: 10,
|
|
180
|
+
index: i,
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "jsview";
|
|
8
8
|
import Item from "./Item.vue";
|
|
9
9
|
import borderImageUrl from "./assets/border.png";
|
|
10
|
-
import { ref, onMounted } from "vue";
|
|
10
|
+
import { ref, shallowRef, onMounted } from "vue";
|
|
11
11
|
import { useRouter, useRoute } from "vue-router";
|
|
12
12
|
|
|
13
13
|
const router = useRouter();
|
|
@@ -77,7 +77,7 @@ const _onKeyDown = (ev) => {
|
|
|
77
77
|
return false;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const myFocusWidget =
|
|
80
|
+
const myFocusWidget = shallowRef(null);
|
|
81
81
|
|
|
82
82
|
onMounted(() => {
|
|
83
83
|
myFocusWidget.value.getFocusBlockRef().requestFocus();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed } from "vue";
|
|
2
|
+
import { ref, shallowRef, computed } from "vue";
|
|
3
3
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
data: Object,
|
|
@@ -50,7 +50,7 @@ props.onAction.register("onClick", onClicked);
|
|
|
50
50
|
|
|
51
51
|
<template>
|
|
52
52
|
<div :class="focused ? 'focus' : 'blur'" :style="styleValue">
|
|
53
|
-
{{
|
|
53
|
+
{{ data.content }}
|
|
54
54
|
</div>
|
|
55
55
|
</template>
|
|
56
56
|
|
package/samples/Preload/App.vue
CHANGED
|
@@ -11,7 +11,7 @@ import awesome from "./images/awesomeface.png";
|
|
|
11
11
|
import cat from "./images/cat.jpg";
|
|
12
12
|
import { data } from "./data.js";
|
|
13
13
|
import Item from "./Item.vue";
|
|
14
|
-
import { ref } from "vue";
|
|
14
|
+
import { ref, shallowRef } from "vue";
|
|
15
15
|
import { useRouter } from "vue-router";
|
|
16
16
|
|
|
17
17
|
const name = "/preload";
|
package/samples/Preload/Item.vue
CHANGED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-10-24 13:19:41
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-10-24 13:50:18
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { useRouter } from "vue-router";
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
|
|
12
|
+
const test1 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_1.jpeg)";
|
|
13
|
+
const test2 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_2.jpeg)";
|
|
14
|
+
const test3 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_3.jpeg)";
|
|
15
|
+
const test4 = "url(https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/ScaleDownTest/test_4.jpeg)";
|
|
16
|
+
|
|
17
|
+
const onKeyDown = (ev) => {
|
|
18
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
19
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
20
|
+
if (window.JsView) {
|
|
21
|
+
window.JsView.setGlobalConfig({
|
|
22
|
+
texCache: -1,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
router.go(-1); // 有router时,回退
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const style1 = {
|
|
33
|
+
left: 0,
|
|
34
|
+
top: 0,
|
|
35
|
+
width: 250,
|
|
36
|
+
height: 250,
|
|
37
|
+
borderRadius: "15px",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const style2 = {
|
|
41
|
+
left: 0,
|
|
42
|
+
top: 260,
|
|
43
|
+
width: 250,
|
|
44
|
+
height: 250,
|
|
45
|
+
borderRadius: "15px",
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
48
|
+
<template>
|
|
49
|
+
<jsv-focus-block autoFocus :onKeyDown="onKeyDown">
|
|
50
|
+
<div class="allBgc">
|
|
51
|
+
<div class="block">
|
|
52
|
+
<div :style="{ left: 0, top: 0 }">
|
|
53
|
+
<div class="leftFont top0">
|
|
54
|
+
{{ `原图加载` }}
|
|
55
|
+
</div>
|
|
56
|
+
<div class="leftFont top250">
|
|
57
|
+
{{ `使用缩小算法优化` }}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div :style="{ left: 120, top: 0 }">
|
|
62
|
+
<img alt="" :style="style1" :src="test4" />
|
|
63
|
+
<img alt="" :style="style2" jsvImgScaledownTex :src="test4" />
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div :style="{ left: 380, top: 0 }">
|
|
67
|
+
<img alt="" :style="style1" :src="test1" />
|
|
68
|
+
<img alt="" :style="style2" jsvImgScaledownTex :src="test1" />
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div :style="{ left: 640, top: 0 }">
|
|
72
|
+
<img alt="" :style="style1" :src="test2" />
|
|
73
|
+
<img alt="" :style="style2" jsvImgScaledownTex :src="test2" />
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div :style="{ left: 900, top: 0 }">
|
|
77
|
+
<img alt="" :style="style1" :src="test3" />
|
|
78
|
+
<img alt="" :style="style2" jsvImgScaledownTex :src="test3" />
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</jsv-focus-block>
|
|
83
|
+
</template>
|
|
84
|
+
<style scoped>
|
|
85
|
+
.allBgc {
|
|
86
|
+
width: 1920;
|
|
87
|
+
height: 1080;
|
|
88
|
+
background-color: #334c4c;
|
|
89
|
+
}
|
|
90
|
+
.block {
|
|
91
|
+
left: 20;
|
|
92
|
+
top: 50;
|
|
93
|
+
}
|
|
94
|
+
.leftFont {
|
|
95
|
+
left: 0;
|
|
96
|
+
width: 100;
|
|
97
|
+
height: 200;
|
|
98
|
+
color: #ffffff;
|
|
99
|
+
font-size: 25px;
|
|
100
|
+
}
|
|
101
|
+
.top0 {
|
|
102
|
+
top: 0;
|
|
103
|
+
}
|
|
104
|
+
.top250 {
|
|
105
|
+
top: 250;
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -10,7 +10,7 @@ import coin from "./coin.mp3";
|
|
|
10
10
|
import lose from "./lose.mp3";
|
|
11
11
|
import bgmusic from "./bgmusic.mp3";
|
|
12
12
|
import { JsvSoundPool, jJsvRuntimeBridge } from "jsview";
|
|
13
|
-
import { onMounted, onBeforeUnmount,
|
|
13
|
+
import { onMounted, onBeforeUnmount, shallowRef } from "vue";
|
|
14
14
|
import { useRouter } from "vue-router";
|
|
15
15
|
|
|
16
16
|
const router = useRouter();
|
|
@@ -19,7 +19,7 @@ let coinController1 = null;
|
|
|
19
19
|
let coinController2 = null;
|
|
20
20
|
let loseController1 = null;
|
|
21
21
|
let loseController2 = null;
|
|
22
|
-
let bgm =
|
|
22
|
+
let bgm = shallowRef(null);
|
|
23
23
|
const _onKeyDown = (ev) => {
|
|
24
24
|
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
25
25
|
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
@@ -128,7 +128,7 @@ onBeforeUnmount(() => {
|
|
|
128
128
|
`[确定]: 播放背景音乐\n[左]: 播放失败音乐1\n[右]: 播放失败音乐2\n[上]: 播放硬币音乐1\n[下]: 播放硬币音乐2`
|
|
129
129
|
}}
|
|
130
130
|
</div>
|
|
131
|
-
<audiotrack ref="bgm" :src="bgmusic" loop="loop" />
|
|
131
|
+
<jsv-audiotrack ref="bgm" :src="bgmusic" loop="loop" />
|
|
132
132
|
</div>
|
|
133
133
|
</jsv-focus-block>
|
|
134
134
|
</template>
|