@shijiu/jsview-vue 0.9.502 → 0.9.631
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/target_core_revision.js +4 -3
- package/index.js +10 -0
- package/package.json +8 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +16 -5
- package/samples/AnimPicture/App.vue +89 -106
- package/samples/Basic/App.vue +65 -68
- package/samples/Basic/components/ContentBlock.vue +31 -36
- package/samples/Basic/components/anim/AnimGroup.vue +61 -75
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +54 -43
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +25 -31
- package/samples/Basic/components/anim/AnimTransition.vue +142 -105
- package/samples/Basic/components/div/DivBackground.vue +38 -16
- package/samples/Basic/components/div/DivClip.vue +143 -78
- package/samples/Basic/components/div/DivCssScoped.vue +10 -10
- package/samples/Basic/components/div/DivCssVar.vue +40 -42
- package/samples/Basic/components/div/DivGroup1.vue +45 -39
- package/samples/Basic/components/div/DivGroup2.vue +56 -45
- package/samples/Basic/components/div/DivLayout.vue +63 -5
- package/samples/Basic/components/div/DivRadius.vue +51 -42
- package/samples/Basic/components/div/DivTransform.vue +21 -16
- package/samples/Basic/components/panel/Panel1.vue +46 -44
- package/samples/Basic/components/panel/Panel2.vue +22 -26
- package/samples/Basic/components/panel/TitleBar.vue +12 -12
- package/samples/Basic/components/text/TextAlign.vue +54 -44
- package/samples/Basic/components/text/TextEmoji.vue +16 -20
- package/samples/Basic/components/text/TextFontStyle.vue +77 -53
- package/samples/Basic/components/text/TextGroup1.vue +46 -38
- package/samples/Basic/components/text/TextGroup2.vue +25 -28
- package/samples/Basic/components/text/TextOverflow.vue +78 -59
- package/samples/BasicFocusControl/App.vue +22 -43
- package/samples/BasicFocusControl/components/BaseBlock.vue +42 -43
- package/samples/BasicFocusControl/components/MainArea.vue +55 -70
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +11 -15
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +21 -24
- package/samples/BasicFocusControl/components/SideBar.vue +32 -47
- package/samples/BasicFocusControl/components/SideBarBlock.vue +20 -23
- package/samples/Collision/App.vue +452 -0
- package/samples/ColorSpace/App.vue +15 -24
- package/samples/DemoHomepage/App.vue +7 -11
- package/samples/DemoHomepage/components/BodyFrame.vue +21 -9
- package/samples/DemoHomepage/components/TabFrame.vue +7 -8
- package/samples/DemoHomepage/router.js +52 -33
- package/samples/DemoHomepage/views/Homepage.vue +18 -9
- package/samples/FilterDemo/AnimatePic.vue +58 -0
- package/samples/FilterDemo/App.vue +99 -61
- package/samples/FilterDemo/VideoLayer.vue +62 -0
- package/samples/FlipCard/App.vue +32 -41
- package/samples/FlipCard/FlipCard.vue +48 -54
- package/samples/GridDemo/App.vue +109 -77
- package/samples/GridDemo/ButtonBlock.vue +50 -49
- package/samples/GridDemo/FocusItem.vue +19 -38
- package/samples/GridDemo/Item.vue +46 -54
- package/samples/HashHistory/App.vue +63 -79
- package/samples/HashHistory/components/HorizontalButtonList.vue +72 -95
- package/samples/HashHistory/components/Item.vue +42 -56
- package/samples/HashHistory/router.js +23 -12
- package/samples/HashHistory/views/MainPage.vue +35 -46
- package/samples/HashHistory/views/SubPage.vue +34 -47
- package/samples/ImpactStop/App.vue +435 -0
- package/samples/Input/App.vue +8 -18
- package/samples/Input/FullKeyboard.vue +2 -6
- package/samples/Input/InputPanel.vue +18 -12
- package/samples/Input/KeyboardItem.vue +1 -1
- package/samples/LongImage/App.vue +11 -27
- package/samples/LongImage/Button.vue +50 -145
- package/samples/LongImage/ButtonItem.vue +44 -0
- package/samples/LongImage/LongImageScroll.vue +71 -106
- package/samples/LongImage/Scroll.vue +7 -9
- package/samples/LongText/App.vue +13 -28
- package/samples/LongText/Button.vue +43 -145
- package/samples/LongText/ButtonItem.vue +44 -0
- package/samples/LongText/LongTextScroll.vue +68 -101
- package/samples/LongText/Scroll.vue +7 -9
- package/samples/Marquee/App.vue +34 -37
- package/samples/MaskClip/App.vue +17 -30
- package/samples/MetroWidgetDemos/Advanced/App.vue +47 -0
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
- package/samples/MetroWidgetDemos/Advanced/Widgets.vue +71 -0
- package/samples/MetroWidgetDemos/Item.vue +67 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/App.vue +80 -104
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/Item.vue +7 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/bg.jpg +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_content.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_left.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_mid.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_right.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/focus_border.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/holder_logo.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/jrbm.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_left.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_mid.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_right.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/loading.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/logo.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/mcjx.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tao.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tmall.png +0 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/border.png +0 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/ContentItem.vue +60 -86
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/MyTab.vue +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/samples/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
- package/samples/MetroWidgetDemos/Simple/App.vue +45 -0
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
- package/samples/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/samples/MetroWidgetDemos/data.js +204 -0
- package/samples/NinePatchDemo/App.vue +114 -115
- package/samples/NinePatchDemo/Item.vue +7 -8
- package/samples/Preload/App.vue +67 -64
- package/samples/Preload/Item.vue +21 -29
- package/samples/QrcodeDemo/App.vue +24 -29
- package/samples/SoundPool/App.vue +77 -106
- package/samples/SprayView/App.vue +10 -8
- package/samples/SpriteImage/App.vue +1 -2
- package/samples/TextBox/App.vue +86 -101
- package/samples/TextBox/RenderCenter.vue +1 -1
- package/samples/TextBox/RenderLeft.vue +1 -1
- package/samples/TextBox/RenderOneLine.vue +1 -1
- package/samples/TextBox/RenderRight.vue +1 -1
- package/samples/TextShadowDemo/App.vue +1 -2
- package/samples/TextureAnimation/App.vue +16 -13
- package/samples/TextureAnimation/App2.vue +111 -0
- package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/samples/TextureAnimation/assets/mask.png +0 -0
- package/samples/TextureSize/App.vue +15 -25
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +2 -4
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +2 -3
- package/samples/ThrowMoveDemo/TargetDemo.vue +3 -4
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +2 -3
- package/samples/TouchSample/App.vue +2 -3
- package/samples/TouchSample/Item.vue +15 -13
- package/samples/TouchSample/MetroWidgetHorizontal.vue +2 -2
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TouchSample/TouchContainerHorizontal.vue +4 -3
- package/samples/TouchSample/TouchContainerVertical.vue +3 -2
- package/samples/TransitPage/App.vue +20 -32
- package/samples/VideoDemo/App.vue +65 -81
- package/samples/VideoDemo/components/Button.vue +41 -52
- package/samples/VideoDemo/components/Controllor.vue +171 -169
- package/samples/VideoDemo/components/VideoFrame.vue +87 -99
- package/samples/VisibleSensorDemo/App.vue +234 -0
- package/scripts/jsview-jsmap-serve.js +42 -0
- package/scripts/jsview-post-install.js +1 -1
- package/tsconfig.json +3 -0
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +204 -193
- package/utils/JsViewEngineWidget/JsvFocusManager.js +30 -17
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +1561 -1656
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
- package/utils/JsViewEngineWidget/TemplateParser.js +111 -1
- package/utils/JsViewEngineWidget/WidgetCommon.js +8 -2
- package/utils/JsViewEngineWidget/index.js +4 -4
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +301 -58
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +22 -3
- package/utils/JsViewPlugin/JsvPlayer/index.js +8 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
- package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
- package/utils/JsViewVueTools/index.js +20 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +8 -4
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
- package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
- package/utils/JsViewVueWidget/JsvGrid.vue +139 -41
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +3 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +8 -17
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +37 -7
- package/utils/JsViewVueWidget/JsvPosterImage.vue +34 -13
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +39 -53
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +6 -1
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +6 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +142 -61
- package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
- package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +141 -0
- package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +9 -0
- package/utils/JsViewVueWidget/index.js +42 -0
- package/samples/AdvanceMetroWidget/App.vue +0 -123
- package/samples/AdvanceMetroWidget/Frame.vue +0 -102
- package/samples/AdvanceMetroWidget/Item.vue +0 -63
- package/samples/AdvanceMetroWidget/data.js +0 -137
- package/samples/ClassNameDemo/App.vue +0 -119
- package/samples/ClassNameDemo/components/ContentItem.vue +0 -253
- package/samples/ClassNameDemo/components/LoadingView.vue +0 -43
- package/samples/ClassNameDemo/components/TitleView.vue +0 -24
- package/samples/ClassNameDemo/data.js +0 -24
- package/samples/FlowMultiWidget/App.vue +0 -91
- package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
- package/samples/FlowMultiWidget/components/Block.vue +0 -107
- package/samples/FlowMultiWidget/components/FlowPage.vue +0 -60
- package/samples/FlowMultiWidget/components/Item.vue +0 -103
- package/samples/FlowMultiWidget/components/MenuItem.vue +0 -72
- package/samples/FlowMultiWidget/components/MyMenu.vue +0 -90
- package/samples/FlowMultiWidget/data.js +0 -446
- package/samples/HashHistory/views/BasePage.vue +0 -19
- package/samples/HashHistory/views/SubPageFirst.vue +0 -10
- package/samples/HashHistory/views/SubPageSecond.vue +0 -10
- package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
- package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
- package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
- package/samples/SimpleWidgetDemo/data.js +0 -124
- package/utils/JsViewEngineWidget/MetroWidget/ContentView.vue +0 -63
- package/utils/JsViewEngineWidget/MetroWidget/DivWrapper.vue +0 -51
- package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +0 -213
- package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +0 -154
|
@@ -2,62 +2,54 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-05-10 15:21:24
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:48:32
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
22
|
-
return (
|
|
23
|
-
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
focused: ref(false),
|
|
28
|
-
randomColor,
|
|
29
|
-
divNumber: new Array(50),
|
|
30
|
-
blurAction: false,
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
onFocus() {
|
|
35
|
-
console.log("item onfocus", this.userData);
|
|
36
|
-
this.focused = true;
|
|
37
|
-
this.blurAction = false;
|
|
38
|
-
},
|
|
39
|
-
onBlur() {
|
|
40
|
-
console.log("item onblur", this.userData, this.widgetData.getCurrentFocusId(), this.widgetData.dataIndex);
|
|
41
|
-
this.focused = false;
|
|
42
|
-
if (this.widgetData.getCurrentFocusId() == this.widgetData.dataIndex) {
|
|
43
|
-
this.blurAction = true;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
onClick() {
|
|
47
|
-
console.log("item onclick ", this.userData);
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
created() {
|
|
51
|
-
if (this.onAction) {
|
|
52
|
-
this.onAction.register("onFocus", this.onFocus);
|
|
53
|
-
this.onAction.register("onBlur", this.onBlur);
|
|
54
|
-
this.onAction.register("onClick", this.onClick);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
mounted() {
|
|
58
|
-
// console.log("item mounted", this.userData, this.widgetData);
|
|
59
|
-
},
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, onUpdated, onMounted } from "vue";
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
userData: Object,
|
|
13
|
+
widgetData: Object,
|
|
14
|
+
onAction: Object,
|
|
15
|
+
});
|
|
16
|
+
const randomColor = () => {
|
|
17
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
18
|
+
return (
|
|
19
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
20
|
+
);
|
|
60
21
|
};
|
|
22
|
+
const focused = ref(false);
|
|
23
|
+
const divNumber = new Array(50);
|
|
24
|
+
const blurAction = false;
|
|
25
|
+
|
|
26
|
+
const onFocus = () => {
|
|
27
|
+
console.log("item onfocus", props.userData);
|
|
28
|
+
focused.value = true;
|
|
29
|
+
};
|
|
30
|
+
const onBlur = () => {
|
|
31
|
+
console.log(
|
|
32
|
+
"item onblur",
|
|
33
|
+
props.userData,
|
|
34
|
+
props.widgetData.getCurrentFocusId(),
|
|
35
|
+
props.widgetData.dataIndex
|
|
36
|
+
);
|
|
37
|
+
focused.value = false;
|
|
38
|
+
};
|
|
39
|
+
const onClick = () => {
|
|
40
|
+
console.log("item onclick ", props.userData);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
props.onAction.register("onFocus", onFocus);
|
|
44
|
+
props.onAction.register("onBlur", onBlur);
|
|
45
|
+
props.onAction.register("onClick", onClick);
|
|
46
|
+
|
|
47
|
+
onUpdated(() => {
|
|
48
|
+
console.log("item updated", props.userData, props.widgetData);
|
|
49
|
+
});
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
console.log("item mounted", props.userData, props.widgetData);
|
|
52
|
+
});
|
|
61
53
|
</script>
|
|
62
54
|
|
|
63
55
|
<template>
|
|
@@ -91,7 +83,7 @@ export default {
|
|
|
91
83
|
></div>
|
|
92
84
|
<div
|
|
93
85
|
:style="{
|
|
94
|
-
visibility:
|
|
86
|
+
visibility: !focused && widgetData.selected ? 'visible' : 'hidden',
|
|
95
87
|
left: 50,
|
|
96
88
|
width: 20,
|
|
97
89
|
height: 20,
|
|
@@ -1,92 +1,76 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for(const route of routeList) {
|
|
26
|
-
if(route.path === "/") { // 不需要添加home
|
|
27
|
-
redirectPath = route.redirect;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const subRoute = {...route, path: route.path.substring(1)} // 去掉字符'/'
|
|
32
|
-
currentRouter.addRoute(currentRoute.name as string, subRoute)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
currentRouter.replace(props.routePath + redirectPath) // 自动跳转到redirectPath
|
|
36
|
-
} else { // 作为全局router使用
|
|
37
|
-
currentRouter = App.Router;
|
|
1
|
+
<script setup>
|
|
2
|
+
import { jJsvRuntimeBridge } from "jsview";
|
|
3
|
+
import { router, routeList } from "./router.js";
|
|
4
|
+
import { useRouter, useRoute } from "vue-router";
|
|
5
|
+
import { onMounted, ref } from "vue";
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
routePath: String,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const displayUrl = ref("");
|
|
12
|
+
let topRef = ref(null);
|
|
13
|
+
let routePage = ref(null);
|
|
14
|
+
let currentRouter;
|
|
15
|
+
if (props.routePath) {
|
|
16
|
+
const currentRoute = useRoute();
|
|
17
|
+
currentRouter = useRouter();
|
|
18
|
+
|
|
19
|
+
let redirectPath; // 自动跳转路径
|
|
20
|
+
for (const route of routeList) {
|
|
21
|
+
if (route.path === "/") {
|
|
22
|
+
// 不需要添加home
|
|
23
|
+
redirectPath = route.redirect;
|
|
24
|
+
continue;
|
|
38
25
|
}
|
|
39
26
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// Override
|
|
44
|
-
mounted() {
|
|
45
|
-
// 调试接口,对接JSCenter平台去掉启动图的处理
|
|
46
|
-
jJsvRuntimeBridge.notifyPageLoaded();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private onRequestFocus(branchName: string) {
|
|
50
|
-
this.topRef.findBlockByname(branchName)?.requestFocus();
|
|
27
|
+
const subRoute = { ...route, path: route.path.substring(1) }; // 去掉字符'/'
|
|
28
|
+
currentRouter.addRoute(currentRoute.name, subRoute);
|
|
51
29
|
}
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private onKeyDown(event: any) {
|
|
60
|
-
return this.routePage?.onKeyDown(event);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private topRef!: any;
|
|
64
|
-
private displayUrl: string = "";
|
|
65
|
-
private routePage: any = null;
|
|
66
|
-
|
|
67
|
-
static Router: Router = router;
|
|
31
|
+
currentRouter.replace(props.routePath + redirectPath); // 自动跳转到redirectPath
|
|
32
|
+
} else {
|
|
33
|
+
currentRouter = router;
|
|
68
34
|
}
|
|
69
|
-
|
|
70
|
-
|
|
35
|
+
currentRouter.afterEach(() => {
|
|
36
|
+
displayUrl.value = window.location.href;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const onRequestFocus = (branchName) => {
|
|
40
|
+
topRef.value.findBlockByname(branchName)?.requestFocus();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const watchRouterChanged = (route) => {
|
|
44
|
+
route.afterEach(() => {
|
|
45
|
+
displayUrl.value = window.location.href;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const onKeyDown = (event) => {
|
|
50
|
+
return routePage.value.onKeyDown(event);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
onMounted(() => {
|
|
54
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
55
|
+
});
|
|
71
56
|
</script>
|
|
72
57
|
|
|
73
58
|
<template>
|
|
74
|
-
<div class="root">
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</div>
|
|
78
|
-
<div class="split" />
|
|
59
|
+
<div class="root">
|
|
60
|
+
<div class="address">当前URL: {{ displayUrl }}</div>
|
|
61
|
+
<div class="split"></div>
|
|
79
62
|
<jsv-focus-block ref="topRef">
|
|
80
63
|
<!-- 这种router-view的写法可以获取到component的ref,vue标准写法 -->
|
|
81
64
|
<router-view v-slot="{ Component }">
|
|
82
|
-
<component
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
<component
|
|
66
|
+
:is="Component"
|
|
67
|
+
ref="routePage"
|
|
68
|
+
class="router"
|
|
69
|
+
@requestFocus="onRequestFocus"
|
|
86
70
|
/>
|
|
87
71
|
</router-view>
|
|
88
72
|
</jsv-focus-block>
|
|
89
|
-
</div>
|
|
73
|
+
</div>
|
|
90
74
|
</template>
|
|
91
75
|
|
|
92
76
|
<style scoped>
|
|
@@ -95,7 +79,7 @@ export default App;
|
|
|
95
79
|
top: 0;
|
|
96
80
|
width: 1280;
|
|
97
81
|
height: 1080;
|
|
98
|
-
background-color: rgb(222,211,140)
|
|
82
|
+
background-color: rgb(222, 211, 140);
|
|
99
83
|
}
|
|
100
84
|
|
|
101
85
|
.address {
|
|
@@ -111,12 +95,12 @@ export default App;
|
|
|
111
95
|
top: 150;
|
|
112
96
|
width: 1200;
|
|
113
97
|
height: 3;
|
|
114
|
-
background-color: #
|
|
98
|
+
background-color: #00f000;
|
|
115
99
|
}
|
|
116
100
|
|
|
117
101
|
.router {
|
|
118
|
-
left:0;
|
|
119
|
-
top:150;
|
|
102
|
+
left: 0;
|
|
103
|
+
top: 150;
|
|
120
104
|
width: 1920;
|
|
121
105
|
height: 930;
|
|
122
106
|
overflow: hidden;
|
|
@@ -1,114 +1,91 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { JsvFocusEvent } from "jsview/utils/JsViewEngineWidget";
|
|
3
|
-
import { Options, Vue } from "vue-class-component";
|
|
1
|
+
<script setup>
|
|
4
2
|
import Item from "./Item.vue";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
style: Object,
|
|
6
|
+
buttonConfig: Object,
|
|
7
|
+
onButtonClick: Function,
|
|
8
|
+
onBack: Function,
|
|
9
|
+
});
|
|
10
|
+
const maxWidth = 1280;
|
|
11
|
+
const listPadding = 10;
|
|
12
|
+
const buttonWidth = 400;
|
|
13
|
+
const buttonHeight = 80;
|
|
14
|
+
const buttonGap = 50;
|
|
15
|
+
let focusedItemIndex = 0;
|
|
16
|
+
|
|
17
|
+
let listLeft = 0;
|
|
18
|
+
const listWidth = (buttonWidth + buttonGap) * props.buttonConfig.length;
|
|
19
|
+
|
|
20
|
+
// 根据maxWidth,计算buttons的左边位置
|
|
21
|
+
const widthCenter = listWidth - buttonGap; // 减去最后一个元素的gap
|
|
22
|
+
if (widthCenter < maxWidth) {
|
|
23
|
+
listLeft = Math.floor((maxWidth - widthCenter) / 2);
|
|
24
|
+
}
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
const listSize = {
|
|
27
|
+
left: listLeft,
|
|
28
|
+
width: listWidth,
|
|
29
|
+
height: buttonHeight,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const onKeyDown = (ev) => {
|
|
33
|
+
if (ev.keyCode === 13) {
|
|
34
|
+
// Enter
|
|
35
|
+
props.onButtonClick?.(focusedItemIndex);
|
|
36
|
+
return true;
|
|
37
|
+
} else if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
38
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
39
|
+
props.onBack?.();
|
|
40
|
+
return true;
|
|
24
41
|
}
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
width: listWidth,
|
|
39
|
-
height: this.buttonHeight,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return listSize;
|
|
43
|
+
let changeFocusTo = -1;
|
|
44
|
+
switch (ev.keyCode) {
|
|
45
|
+
case 37: // Left
|
|
46
|
+
changeFocusTo =
|
|
47
|
+
(focusedItemIndex - 1 + props.buttonConfig.length) %
|
|
48
|
+
props.buttonConfig.length;
|
|
49
|
+
break;
|
|
50
|
+
case 39: // Right
|
|
51
|
+
changeFocusTo = (focusedItemIndex + 1) % props.buttonConfig.length;
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
break;
|
|
43
55
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return true;
|
|
49
|
-
} else if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) { // 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
50
|
-
this.onBack?.();
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let changeFocusTo = -1;
|
|
55
|
-
switch (ev.keyCode) {
|
|
56
|
-
case 37: // Left
|
|
57
|
-
changeFocusTo = (this.focusedItemIndex - 1 + this.buttonConfig.length) % this.buttonConfig.length;
|
|
58
|
-
break;
|
|
59
|
-
case 39: // Right
|
|
60
|
-
changeFocusTo = (this.focusedItemIndex + 1) % this.buttonConfig.length;
|
|
61
|
-
break;
|
|
62
|
-
default:
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
if (changeFocusTo >= 0) {
|
|
66
|
-
ev.ownerNode.findBlockByName(changeFocusTo.toString()).requestFocus();
|
|
67
|
-
this.focusedItemIndex = changeFocusTo;
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return false;
|
|
56
|
+
if (changeFocusTo >= 0) {
|
|
57
|
+
ev.ownerNode.findBlockByName(changeFocusTo.toString()).requestFocus();
|
|
58
|
+
focusedItemIndex = changeFocusTo;
|
|
59
|
+
return true;
|
|
72
60
|
}
|
|
73
61
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
private focusedItemIndex = 0;
|
|
77
|
-
|
|
78
|
-
private readonly buttonConfig!: any;
|
|
79
|
-
private readonly onButtonClick?: Function;
|
|
80
|
-
private readonly onBack?: Function;
|
|
81
|
-
|
|
82
|
-
private readonly maxWidth: number = 1280;
|
|
83
|
-
private readonly listPadding: number = 10;
|
|
84
|
-
private readonly buttonWidth: number = 400;
|
|
85
|
-
private readonly buttonHeight: number = 80;
|
|
86
|
-
private readonly buttonGap: number = 50;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default HorizontalButtonList;
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
90
64
|
</script>
|
|
91
65
|
|
|
92
66
|
<template>
|
|
93
|
-
<div :style="style">
|
|
94
|
-
|
|
67
|
+
<div :style="style">
|
|
68
|
+
<jsv-focus-block
|
|
95
69
|
:style="{
|
|
96
70
|
left: listSize.left,
|
|
97
71
|
width: listSize.width + listPadding * 2,
|
|
98
72
|
height: listSize.height + listPadding * 2,
|
|
99
73
|
}"
|
|
100
74
|
:onKeyDown="onKeyDown"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
>
|
|
76
|
+
<Item
|
|
77
|
+
v-for="(item, index) in buttonConfig"
|
|
78
|
+
:key="index"
|
|
79
|
+
:style="{
|
|
80
|
+
left: (buttonWidth + 10) * index,
|
|
81
|
+
width: buttonWidth,
|
|
82
|
+
height: buttonHeight,
|
|
83
|
+
}"
|
|
104
84
|
:name="index.toString()"
|
|
105
85
|
:autoFocus="index === 0"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
</div>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
113
|
-
<style>
|
|
114
|
-
</style>
|
|
86
|
+
>
|
|
87
|
+
{{ item.name }}
|
|
88
|
+
</Item>
|
|
89
|
+
</jsv-focus-block>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
@@ -1,69 +1,55 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getItemStyle() {
|
|
33
|
-
return {
|
|
34
|
-
width: this.style.width,
|
|
35
|
-
height: this.style.height,
|
|
36
|
-
backgroundColor: '#0FF000',
|
|
37
|
-
lineHeight: this.style.height,
|
|
38
|
-
fontSize: `${Math.floor(this.style.height * 0.55)}px`,
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private hasFocused: boolean = false;
|
|
43
|
-
private style!: any;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default Item;
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
style: Object,
|
|
5
|
+
name: String,
|
|
6
|
+
autoFocus: Boolean,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const hasFocused = ref(false);
|
|
10
|
+
const onFocus = () => {
|
|
11
|
+
hasFocused.value = true;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const onBlur = () => {
|
|
15
|
+
hasFocused.value = false;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const focusStyle = {
|
|
19
|
+
width: props.style.width + 10,
|
|
20
|
+
height: props.style.height + 10,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const itemStyle = {
|
|
24
|
+
width: props.style.width,
|
|
25
|
+
height: props.style.height,
|
|
26
|
+
backgroundColor: "#0FF000",
|
|
27
|
+
lineHeight: props.style.height,
|
|
28
|
+
fontSize: `${Math.floor(props.style.height * 0.55)}px`,
|
|
29
|
+
};
|
|
47
30
|
</script>
|
|
48
31
|
|
|
49
32
|
<template>
|
|
50
|
-
<jsv-focus-block
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
<jsv-focus-block
|
|
34
|
+
:name="name"
|
|
35
|
+
:autoFocus="autoFocus ? '' : undefined"
|
|
36
|
+
:onFocus="onFocus"
|
|
37
|
+
:onBlur="onBlur"
|
|
38
|
+
>
|
|
39
|
+
<div :style="style">
|
|
40
|
+
<div class="focus" :style="focusStyle" v-if="hasFocused"></div>
|
|
41
|
+
<div class="item" :style="itemStyle">
|
|
42
|
+
<slot></slot>
|
|
43
|
+
</div>
|
|
57
44
|
</div>
|
|
58
|
-
</
|
|
59
|
-
</jsv-focus-block>
|
|
45
|
+
</jsv-focus-block>
|
|
60
46
|
</template>
|
|
61
47
|
|
|
62
48
|
<style scoped>
|
|
63
49
|
.focus {
|
|
64
50
|
top: -5;
|
|
65
51
|
left: -5;
|
|
66
|
-
background-color: #
|
|
52
|
+
background-color: #0000ff;
|
|
67
53
|
}
|
|
68
54
|
.item {
|
|
69
55
|
text-align: center;
|
|
@@ -1,30 +1,41 @@
|
|
|
1
|
-
import { createRouter }
|
|
2
|
-
import { createJsvHashHistory }
|
|
1
|
+
import { createRouter } from "vue-router";
|
|
2
|
+
import { createJsvHashHistory } from "jsview";
|
|
3
3
|
|
|
4
4
|
const routeList = [
|
|
5
5
|
// 功能实例
|
|
6
|
-
{
|
|
6
|
+
{
|
|
7
7
|
name: "Home",
|
|
8
8
|
path: "/",
|
|
9
|
-
redirect: "/__MainJsvApp/MainPage",
|
|
10
|
-
},
|
|
9
|
+
redirect: "/__MainJsvApp/MainPage",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
11
12
|
name: "MainPage",
|
|
12
13
|
path: "/__MainJsvApp/MainPage",
|
|
13
|
-
component: () => import(
|
|
14
|
-
},
|
|
14
|
+
component: () => import("./views/MainPage"),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
15
17
|
name: "SubPageFirst",
|
|
16
18
|
path: "/__MainJsvApp/SubPageFirst",
|
|
17
|
-
component: () => import(
|
|
18
|
-
|
|
19
|
+
component: () => import("./views/SubPage"),
|
|
20
|
+
props: {
|
|
21
|
+
name: "First",
|
|
22
|
+
jumpTo: "Second",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
19
26
|
name: "SubPageSecond",
|
|
20
27
|
path: "/__MainJsvApp/SubPageSecond",
|
|
21
|
-
component: () => import(
|
|
28
|
+
component: () => import("./views/SubPage"),
|
|
29
|
+
props: {
|
|
30
|
+
name: "Second",
|
|
31
|
+
jumpTo: "First",
|
|
32
|
+
},
|
|
22
33
|
},
|
|
23
34
|
];
|
|
24
35
|
|
|
25
36
|
const router = createRouter({
|
|
26
37
|
history: createJsvHashHistory(),
|
|
27
38
|
routes: routeList,
|
|
28
|
-
})
|
|
39
|
+
});
|
|
29
40
|
|
|
30
|
-
export { router, routeList }
|
|
41
|
+
export { router, routeList };
|