@shijiu/jsview-vue 0.9.490 → 0.9.590
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 +20 -6
- 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 +34 -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 +76 -57
- 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/ColorSpace/App.vue +15 -24
- package/samples/DemoHomepage/App.vue +7 -11
- package/samples/DemoHomepage/components/BodyFrame.vue +19 -9
- package/samples/DemoHomepage/components/TabFrame.vue +7 -8
- package/samples/DemoHomepage/router.js +33 -34
- package/samples/DemoHomepage/views/Homepage.vue +24 -8
- 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/Input/App.vue +2 -3
- package/samples/Input/FullKeyboard.vue +2 -6
- package/samples/Input/InputPanel.vue +2 -3
- 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 +211 -0
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -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 +58 -0
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +69 -0
- package/samples/MetroWidgetDemos/PingPong/Item.vue +92 -0
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/samples/MetroWidgetDemos/Simple/App.vue +194 -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/NinePatchDemo/assets/border.png +0 -0
- package/samples/Preload/App.vue +61 -63
- 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/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 +167 -0
- package/scripts/jsview-jsmap-serve.js +42 -0
- package/scripts/jsview-post-build.js +6 -1
- 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 +1557 -1656
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +2 -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 +284 -57
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +5 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +25 -12
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
- package/utils/JsViewVueTools/index.js +19 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +25 -10
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +1 -1
- package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
- package/utils/JsViewVueWidget/JsvGrid.vue +140 -42
- 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 +2 -12
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +13 -4
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +25 -21
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
- 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
|
@@ -1,27 +1,119 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import {
|
|
3
|
+
jJsvRuntimeBridge,
|
|
4
|
+
MetroWidget,
|
|
5
|
+
HORIZONTAL,
|
|
6
|
+
JsvNinePatch,
|
|
7
|
+
} from "jsview";
|
|
8
|
+
import Item from "./Item.vue";
|
|
9
|
+
import borderImageUrl from "./assets/border.png";
|
|
10
|
+
import { ref, onMounted } from "vue";
|
|
11
|
+
import { useRouter, useRoute } from "vue-router";
|
|
12
|
+
|
|
13
|
+
const router = useRouter();
|
|
14
|
+
|
|
15
|
+
const data = [
|
|
16
|
+
{
|
|
17
|
+
blocks: {
|
|
18
|
+
w: 160,
|
|
19
|
+
h: 160,
|
|
20
|
+
},
|
|
21
|
+
color: "#FF9900",
|
|
22
|
+
content: 0,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
blocks: {
|
|
26
|
+
w: 300,
|
|
27
|
+
h: 300,
|
|
28
|
+
},
|
|
29
|
+
color: "#0099FF",
|
|
30
|
+
content: 1,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
blocks: {
|
|
34
|
+
w: 160,
|
|
35
|
+
h: 160,
|
|
36
|
+
},
|
|
37
|
+
color: "#FF9900",
|
|
38
|
+
content: 2,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const framePosition = ref({
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0,
|
|
45
|
+
width: 50,
|
|
46
|
+
height: 50,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const _onFramePositionChanged = (new_x, new_y, new_width, new_height) => {
|
|
50
|
+
console.log(
|
|
51
|
+
`new x=${new_x} y=${new_y} width=${new_width} height=${new_height}`
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
framePosition.value = {
|
|
55
|
+
x: new_x,
|
|
56
|
+
y: new_y,
|
|
57
|
+
width: new_width,
|
|
58
|
+
height: new_height,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const _measures = (item) => {
|
|
63
|
+
return {
|
|
64
|
+
width: item.blocks.w,
|
|
65
|
+
height: item.blocks.h,
|
|
66
|
+
marginRight: 10,
|
|
67
|
+
marginTop: 10,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const _onKeyDown = (ev) => {
|
|
72
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
73
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
74
|
+
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const myFocusWidget = ref(null);
|
|
81
|
+
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
myFocusWidget.value.getFocusBlockRef().requestFocus();
|
|
84
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
|
|
1
88
|
<template>
|
|
2
89
|
<div :style="{ width: 1280, height: 720, backgroundColor: '#FFFFFF' }">
|
|
3
90
|
<jsv-focus-block ref="focusNode" :onKeyDown="_onKeyDown">
|
|
4
|
-
<div
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
91
|
+
<div
|
|
92
|
+
:style="{
|
|
93
|
+
textAlign: 'center',
|
|
94
|
+
fontSize: 30,
|
|
95
|
+
lineHeight: 50,
|
|
96
|
+
color: '#ffffff',
|
|
97
|
+
left: 140,
|
|
98
|
+
top: 20,
|
|
99
|
+
width: 1000,
|
|
100
|
+
height: 50,
|
|
101
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
102
|
+
}"
|
|
103
|
+
>
|
|
104
|
+
NinePatch展示,框的四个角的方形中心和项目的四个顶点严格对齐
|
|
105
|
+
</div>
|
|
15
106
|
<metro-widget
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
107
|
+
ref="myFocusWidget"
|
|
108
|
+
:top="100"
|
|
109
|
+
:left="250"
|
|
110
|
+
:width="1000"
|
|
111
|
+
:height="400"
|
|
112
|
+
:direction="HORIZONTAL"
|
|
113
|
+
:data="data"
|
|
114
|
+
:measures="_measures"
|
|
115
|
+
:padding="{ left: 50, right: 50, top: 50, height: 50 }"
|
|
116
|
+
>
|
|
25
117
|
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
26
118
|
<item
|
|
27
119
|
:data="data"
|
|
@@ -32,7 +124,7 @@
|
|
|
32
124
|
/>
|
|
33
125
|
</template>
|
|
34
126
|
</metro-widget>
|
|
35
|
-
<div :style="{top:150, left:300}">
|
|
127
|
+
<div :style="{ top: 150, left: 300 }">
|
|
36
128
|
<jsv-nine-patch
|
|
37
129
|
:style="{
|
|
38
130
|
width: framePosition.width,
|
|
@@ -40,7 +132,7 @@
|
|
|
40
132
|
top: framePosition.y,
|
|
41
133
|
left: framePosition.x,
|
|
42
134
|
}"
|
|
43
|
-
:imageUrl="
|
|
135
|
+
:imageUrl="borderImageUrl"
|
|
44
136
|
:imageWidth="81"
|
|
45
137
|
:centerWidth="25"
|
|
46
138
|
:borderOutset="14"
|
|
@@ -51,96 +143,3 @@
|
|
|
51
143
|
</jsv-focus-block>
|
|
52
144
|
</div>
|
|
53
145
|
</template>
|
|
54
|
-
<script setup>
|
|
55
|
-
import { jJsvRuntimeBridge } from "jsview/utils/JsViewVueTools/JsvRuntimeBridge";
|
|
56
|
-
import {
|
|
57
|
-
HORIZONTAL,
|
|
58
|
-
MetroWidget,
|
|
59
|
-
} from "jsview/utils/JsViewEngineWidget";
|
|
60
|
-
import JsvNinePatch from "jsview/utils/JsViewVueWidget/JsvNinePatch.vue";
|
|
61
|
-
import Item from "./Item.vue";
|
|
62
|
-
import borderImageUrl from "./assets/border.png"
|
|
63
|
-
import { ref, onMounted } from 'vue'
|
|
64
|
-
import { useRouter, useRoute } from 'vue-router'
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const router = useRouter();
|
|
68
|
-
|
|
69
|
-
const data = [
|
|
70
|
-
{
|
|
71
|
-
blocks: {
|
|
72
|
-
w: 160,
|
|
73
|
-
h: 160
|
|
74
|
-
},
|
|
75
|
-
color: "#FF9900",
|
|
76
|
-
content: 0
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
blocks: {
|
|
80
|
-
w: 300,
|
|
81
|
-
h: 300
|
|
82
|
-
},
|
|
83
|
-
color: "#0099FF",
|
|
84
|
-
content: 1
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
blocks: {
|
|
88
|
-
w: 160,
|
|
89
|
-
h: 160
|
|
90
|
-
},
|
|
91
|
-
color: "#FF9900",
|
|
92
|
-
content: 2
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
const framePosition = ref({
|
|
97
|
-
x: 0,
|
|
98
|
-
y: 0,
|
|
99
|
-
width: 50,
|
|
100
|
-
height: 50
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const direction = HORIZONTAL;
|
|
104
|
-
|
|
105
|
-
const imageUrl = borderImageUrl;
|
|
106
|
-
|
|
107
|
-
const _onFramePositionChanged = (new_x, new_y, new_width, new_height) => {
|
|
108
|
-
console.log(`new x=${new_x} y=${new_y} width=${new_width} height=${new_height}`);
|
|
109
|
-
|
|
110
|
-
framePosition.value = {
|
|
111
|
-
x: new_x,
|
|
112
|
-
y: new_y,
|
|
113
|
-
width: new_width,
|
|
114
|
-
height: new_height
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const _measures = (item)=>{
|
|
119
|
-
return {
|
|
120
|
-
width: item.blocks.w,
|
|
121
|
-
height: item.blocks.h,
|
|
122
|
-
marginRight: 10,
|
|
123
|
-
marginTop: 10,
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const _onKeyDown = (ev) => {
|
|
128
|
-
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
129
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
130
|
-
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
return false;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const myFocusWidget = ref(null);
|
|
137
|
-
|
|
138
|
-
onMounted(()=>{
|
|
139
|
-
myFocusWidget.value.getFocusBlockRef().requestFocus();
|
|
140
|
-
jJsvRuntimeBridge.notifyPageLoaded();
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
</script>
|
|
144
|
-
<style scoped>
|
|
145
|
-
|
|
146
|
-
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed } from
|
|
2
|
+
import { ref, computed } from "vue";
|
|
3
3
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
data: Object,
|
|
@@ -11,7 +11,7 @@ const props = defineProps({
|
|
|
11
11
|
|
|
12
12
|
let focused = ref(false);
|
|
13
13
|
|
|
14
|
-
let styleValue = computed(()=>{
|
|
14
|
+
let styleValue = computed(() => {
|
|
15
15
|
return {
|
|
16
16
|
width: props.data.blocks.w,
|
|
17
17
|
height: props.data.blocks.h,
|
|
@@ -20,7 +20,7 @@ let styleValue = computed(()=>{
|
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const onFocus = ()=>{
|
|
23
|
+
const onFocus = () => {
|
|
24
24
|
focused.value = true;
|
|
25
25
|
if (props.frameChanged) {
|
|
26
26
|
let pos = props.query.position(props.query.id);
|
|
@@ -33,25 +33,24 @@ const onFocus = ()=>{
|
|
|
33
33
|
|
|
34
34
|
props.frameChanged(new_x, new_y, new_width, new_height);
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
|
|
38
|
-
const onBlur = ()=>{
|
|
38
|
+
const onBlur = () => {
|
|
39
39
|
focused.value = false;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const onClicked = ()=>{
|
|
42
|
+
const onClicked = () => {
|
|
43
43
|
onsole.log(`item ${props.query.id} clicked`);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
props.onAction.register("onFocus", onFocus);
|
|
47
47
|
props.onAction.register("onBlur", onBlur);
|
|
48
48
|
props.onAction.register("onClick", onClicked);
|
|
49
|
-
|
|
50
49
|
</script>
|
|
51
50
|
|
|
52
51
|
<template>
|
|
53
52
|
<div :class="focused ? 'focus' : 'blur'" :style="styleValue">
|
|
54
|
-
{{
|
|
53
|
+
{{ "" + props.data.content + (testData != null ? testData.MyName : "") }}
|
|
55
54
|
</div>
|
|
56
55
|
</template>
|
|
57
56
|
|
|
Binary file
|
package/samples/Preload/App.vue
CHANGED
|
@@ -1,69 +1,67 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {
|
|
1
|
+
<script setup>
|
|
2
|
+
import {
|
|
3
|
+
HORIZONTAL,
|
|
4
|
+
MetroWidget,
|
|
5
|
+
JsvPreload,
|
|
6
|
+
buildPreloadInfo,
|
|
7
|
+
buildDownloadInfo,
|
|
8
|
+
} from "jsview";
|
|
3
9
|
import awesome from "./images/awesomeface.png";
|
|
4
10
|
import cat from "./images/cat.jpg";
|
|
5
11
|
import { data } from "./data.js";
|
|
6
12
|
import Item from "./Item.vue";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
import { ref } from "vue";
|
|
14
|
+
import { useRouter } from "vue-router";
|
|
15
|
+
|
|
16
|
+
const name = "/preload";
|
|
17
|
+
const text = ref("");
|
|
18
|
+
let = preloadInfo = [];
|
|
19
|
+
let = downloadInfo = [];
|
|
20
|
+
const router = useRouter();
|
|
21
|
+
let focusNode = ref(null);
|
|
22
|
+
|
|
23
|
+
const _onPreloading = (percent) => {
|
|
24
|
+
console.log("preloading ", percent);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const _onPreloadDone = (imageInfo) => {
|
|
28
|
+
console.log("PRELOAD DONE!", imageInfo);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const _onDownloadDone = () => {
|
|
32
|
+
console.log("DOWNLOAD DONE!");
|
|
33
|
+
this.text = `图片下载完成\n${awesome}\n${cat}`;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const _measures = () => {
|
|
37
|
+
return {
|
|
38
|
+
width: 180,
|
|
39
|
+
height: 90,
|
|
40
|
+
focusable: true,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const _onKeyDown = (ev) => {
|
|
45
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
46
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
11
50
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
data() {
|
|
15
|
-
return {
|
|
16
|
-
data,
|
|
17
|
-
name: "/preload",
|
|
18
|
-
text: "",
|
|
19
|
-
direction: HORIZONTAL,
|
|
20
|
-
awesome,
|
|
21
|
-
cat,
|
|
22
|
-
preloadInfo: [],
|
|
23
|
-
downloadInfo: [],
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
methods: {
|
|
27
|
-
_onPreloading(percent) {
|
|
28
|
-
console.log("preloading ", percent)
|
|
29
|
-
},
|
|
30
|
-
_onPreloadDone(imageInfo) {
|
|
31
|
-
console.log("PRELOAD DONE!", imageInfo);
|
|
32
|
-
},
|
|
33
|
-
_onDownloadDone() {
|
|
34
|
-
console.log("DOWNLOAD DONE!");
|
|
35
|
-
this.text = `图片下载完成\n${this.awesome}\n${this.cat}`;
|
|
36
|
-
},
|
|
37
|
-
_measures() {
|
|
38
|
-
return {
|
|
39
|
-
width: 180,
|
|
40
|
-
height: 90,
|
|
41
|
-
focusable: true,
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
_onKeyDown(ev) {
|
|
45
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
46
|
-
this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
47
|
-
}
|
|
48
|
-
return true;
|
|
49
|
-
},
|
|
50
|
-
_onFocus() {
|
|
51
|
-
this.$refs.focusNode.findBlockByName(this.name).requestFocus();
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
created() {
|
|
55
|
-
for (const item of this.data) {
|
|
56
|
-
this.preloadInfo.push(buildPreloadInfo(item.url));
|
|
57
|
-
this.preloadInfo.push(buildPreloadInfo(item.focusUrl));
|
|
58
|
-
}
|
|
59
|
-
this.preloadInfo.push(null); // 测试item为null的加载
|
|
60
|
-
this.downloadInfo = [
|
|
61
|
-
buildDownloadInfo(this.awesome),
|
|
62
|
-
buildDownloadInfo(this.cat),
|
|
63
|
-
buildDownloadInfo(null), // 测试URL为null的加载
|
|
64
|
-
];
|
|
65
|
-
},
|
|
51
|
+
const _onFocus = () => {
|
|
52
|
+
focusNode.value.findBlockByName(name).requestFocus();
|
|
66
53
|
};
|
|
54
|
+
|
|
55
|
+
for (const item of data) {
|
|
56
|
+
preloadInfo.push(buildPreloadInfo(item.url));
|
|
57
|
+
preloadInfo.push(buildPreloadInfo(item.focusUrl));
|
|
58
|
+
}
|
|
59
|
+
preloadInfo.push(null); // 测试item为null的加载
|
|
60
|
+
downloadInfo = [
|
|
61
|
+
buildDownloadInfo(awesome),
|
|
62
|
+
buildDownloadInfo(cat),
|
|
63
|
+
buildDownloadInfo(null), // 测试URL为null的加载
|
|
64
|
+
];
|
|
67
65
|
</script>
|
|
68
66
|
|
|
69
67
|
<template>
|
|
@@ -91,11 +89,11 @@ export default {
|
|
|
91
89
|
预加载后,图片(按钮焦点切换)切换不闪屏
|
|
92
90
|
</div>
|
|
93
91
|
<div :style="{ top: 200, left: 300 }">
|
|
94
|
-
<
|
|
92
|
+
<metro-widget
|
|
95
93
|
:name="name"
|
|
96
94
|
:width="540"
|
|
97
95
|
:height="90"
|
|
98
|
-
:direction="
|
|
96
|
+
:direction="HORIZONTAL"
|
|
99
97
|
:data="data"
|
|
100
98
|
:measures="_measures"
|
|
101
99
|
>
|
|
@@ -107,7 +105,7 @@ export default {
|
|
|
107
105
|
:onAction="onAction"
|
|
108
106
|
/>
|
|
109
107
|
</template>
|
|
110
|
-
</
|
|
108
|
+
</metro-widget>
|
|
111
109
|
</div>
|
|
112
110
|
<div
|
|
113
111
|
:style="{
|
package/samples/Preload/Item.vue
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.focus = true;
|
|
17
|
-
},
|
|
18
|
-
onBlur() {
|
|
19
|
-
this.focus = false;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
created() {
|
|
23
|
-
this.onAction.register("onFocus", this.onFocus);
|
|
24
|
-
this.onAction.register("onBlur", this.onBlur);
|
|
25
|
-
this.onAction.register("onClick", () => {
|
|
26
|
-
console.log("cchtest item on click ", this.data);
|
|
27
|
-
});
|
|
28
|
-
},
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
data: Object,
|
|
5
|
+
query: Object,
|
|
6
|
+
onEdge: Function,
|
|
7
|
+
onAction: Object,
|
|
8
|
+
});
|
|
9
|
+
const focus = ref(false);
|
|
10
|
+
|
|
11
|
+
const onFocus = () => {
|
|
12
|
+
focus.value = true;
|
|
13
|
+
};
|
|
14
|
+
const onBlur = () => {
|
|
15
|
+
focus.value = false;
|
|
29
16
|
};
|
|
17
|
+
props.onAction.register("onFocus", onFocus);
|
|
18
|
+
props.onAction.register("onBlur", onBlur);
|
|
19
|
+
props.onAction.register("onClick", () => {
|
|
20
|
+
console.log("cchtest item on click ", data);
|
|
21
|
+
});
|
|
30
22
|
</script>
|
|
31
23
|
|
|
32
24
|
<template>
|
|
@@ -36,5 +28,5 @@ export default {
|
|
|
36
28
|
height: 90,
|
|
37
29
|
backgroundImage: focus ? data.focusUrl : data.url,
|
|
38
30
|
}"
|
|
39
|
-
|
|
31
|
+
></div>
|
|
40
32
|
</template>
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { JsvQrcode } from "jsview";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
import { useRouter } from "vue-router";
|
|
5
|
+
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
const value = "http://www.baidu.com/";
|
|
8
|
+
const size = 400;
|
|
9
|
+
const fgColor = "#0000FF";
|
|
10
|
+
const bgColor = "#ffff00";
|
|
11
|
+
const level = "H"; // ,容错级别,分别是L(7%)、M(15%)、Q(25%)、H(30%),
|
|
12
|
+
const includeImage = true;
|
|
13
|
+
const imageH = 64;
|
|
14
|
+
const imageW = 64;
|
|
15
|
+
const imageSrc =
|
|
16
|
+
"http://oss.image.51vtv.cn/homepage/20191224/0fdcdc8b258fe7baac16b73f58f8989d.jpg";
|
|
17
|
+
const tipsInfo = `功能:二维码展示可配置项:1.前景色
|
|
18
18
|
2.背景色
|
|
19
19
|
3.指定小图标
|
|
20
|
-
4.容错级别:'L', 'M', 'Q', 'H'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
},
|
|
30
|
-
},
|
|
20
|
+
4.容错级别:'L', 'M', 'Q', 'H'`;
|
|
21
|
+
const onKeyDown = (ev) => {
|
|
22
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
23
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
31
26
|
};
|
|
32
27
|
</script>
|
|
33
28
|
|
|
@@ -55,7 +50,7 @@ export default {
|
|
|
55
50
|
{{ tipsInfo }}
|
|
56
51
|
</div>
|
|
57
52
|
<div :style="{ left: 200, top: 100 }">
|
|
58
|
-
<
|
|
53
|
+
<jsv-qrcode
|
|
59
54
|
:value="value"
|
|
60
55
|
:size="size"
|
|
61
56
|
:fgColor="fgColor"
|