@shijiu/jsview-vue 0.0.1-beta.0
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/docs/IMPORT_CHANGE_LOG.txt +3 -0
- package/docs/git_commit.md +15 -0
- package/docs/test_version_up.txt +1 -0
- package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
- package/dom/browser-root-style.css +21 -0
- package/dom/jsv-browser-debug-dom.js +8 -0
- package/dom/jsv-dom.js +6 -0
- package/dom/jsv-forge-define.js +6 -0
- package/dom/target_core_revision.js +14 -0
- package/load/header_script_loader.js +134 -0
- package/load/jsview-main.js +42 -0
- package/load/jsview.config.default.js +37 -0
- package/load/jsview.default.config.js +37 -0
- package/load/loader.js +172 -0
- package/load/loader_webkit.js +40 -0
- package/package.json +27 -0
- package/patch/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
- package/patch/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
- package/patch/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
- package/patch/node_modules/@vue/cli-service/lib/config/app.js +272 -0
- package/patch/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
- package/patch/node_modules/@vue/cli-service/lib/config/base.js +212 -0
- package/patch/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
- package/patch/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
- package/patch/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
- package/patch/node_modules/postcss-js/objectifier.js +90 -0
- package/patch/node_modules/vue-loader/dist/resolveScript.js +70 -0
- package/patch/package-lock.json +30051 -0
- package/samples/AdvanceMetroWidget/App.vue +123 -0
- package/samples/AdvanceMetroWidget/Frame.vue +101 -0
- package/samples/AdvanceMetroWidget/Item.vue +58 -0
- package/samples/AdvanceMetroWidget/data.js +137 -0
- package/samples/AnimPicture/App.vue +224 -0
- package/samples/AnimPicture/assets/animated_webp.webp +0 -0
- package/samples/AnimPicture/assets/ball_3.webp +0 -0
- package/samples/AnimPicture/assets/girl_run.gif +0 -0
- package/samples/AnimPicture/assets/quan.webp +0 -0
- package/samples/Basic/App.vue +129 -0
- package/samples/Basic/assets/border.png +0 -0
- package/samples/Basic/assets/border2.png +0 -0
- package/samples/Basic/assets/icon.png +0 -0
- package/samples/Basic/assets/test.jpg +0 -0
- package/samples/Basic/components/ContentBlock.vue +36 -0
- package/samples/Basic/components/FontStyle.css +10 -0
- package/samples/Basic/components/TitleBar.vue +29 -0
- package/samples/Basic/components/anim/AnimGroup.vue +68 -0
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +102 -0
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +53 -0
- package/samples/Basic/components/anim/AnimTransition.vue +116 -0
- package/samples/Basic/components/div/DivBackground.vue +15 -0
- package/samples/Basic/components/div/DivClip.vue +81 -0
- package/samples/Basic/components/div/DivCssScoped.vue +27 -0
- package/samples/Basic/components/div/DivCssVar.vue +50 -0
- package/samples/Basic/components/div/DivGroup1.vue +33 -0
- package/samples/Basic/components/div/DivGroup2.vue +41 -0
- package/samples/Basic/components/div/DivLayout.vue +12 -0
- package/samples/Basic/components/div/DivRadius.vue +47 -0
- package/samples/Basic/components/text/TextAlign.vue +48 -0
- package/samples/Basic/components/text/TextFontStyle.vue +58 -0
- package/samples/Basic/components/text/TextGroup.vue +32 -0
- package/samples/Basic/components/text/TextOverflow.vue +78 -0
- package/samples/BasicFocusControl/App.vue +125 -0
- package/samples/BasicFocusControl/components/BaseBlock.vue +51 -0
- package/samples/BasicFocusControl/components/MainArea.vue +98 -0
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +21 -0
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +30 -0
- package/samples/BasicFocusControl/components/SideBar.vue +73 -0
- package/samples/BasicFocusControl/components/SideBarBlock.vue +30 -0
- package/samples/ClassNameDemo/App.vue +119 -0
- package/samples/ClassNameDemo/assets/bg.jpg +0 -0
- package/samples/ClassNameDemo/assets/coupon_content.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_left.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_mid.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_right.png +0 -0
- package/samples/ClassNameDemo/assets/focus_border.png +0 -0
- package/samples/ClassNameDemo/assets/holder_logo.png +0 -0
- package/samples/ClassNameDemo/assets/jrbm.png +0 -0
- package/samples/ClassNameDemo/assets/line_left.png +0 -0
- package/samples/ClassNameDemo/assets/line_mid.png +0 -0
- package/samples/ClassNameDemo/assets/line_right.png +0 -0
- package/samples/ClassNameDemo/assets/loading.png +0 -0
- package/samples/ClassNameDemo/assets/logo.png +0 -0
- package/samples/ClassNameDemo/assets/mcjx.png +0 -0
- package/samples/ClassNameDemo/assets/tao.png +0 -0
- package/samples/ClassNameDemo/assets/tmall.png +0 -0
- package/samples/ClassNameDemo/components/ContentItem.vue +253 -0
- package/samples/ClassNameDemo/components/LoadingView.vue +43 -0
- package/samples/ClassNameDemo/components/TitleView.vue +24 -0
- package/samples/ClassNameDemo/data.js +24 -0
- package/samples/ColorSpace/App.vue +135 -0
- package/samples/ColorSpace/bmpDemo.bmp +0 -0
- package/samples/ColorSpace/jpegDemo.jpeg +0 -0
- package/samples/ColorSpace/pngDemo.png +0 -0
- package/samples/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/samples/DemoHomepage/App.vue +31 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +82 -0
- package/samples/DemoHomepage/components/Dialog.vue +94 -0
- package/samples/DemoHomepage/components/Item.vue +77 -0
- package/samples/DemoHomepage/components/TabFrame.vue +86 -0
- package/samples/DemoHomepage/router.js +132 -0
- package/samples/DemoHomepage/views/Homepage.vue +186 -0
- package/samples/FlipCard/App.vue +80 -0
- package/samples/FlipCard/FlipCard.vue +124 -0
- package/samples/FlipCard/assets/blue_egg.png +0 -0
- package/samples/FlipCard/assets/red_egg.png +0 -0
- package/samples/FlipCard/data.js +13 -0
- package/samples/FlowMultiWidget/App.vue +91 -0
- package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
- package/samples/FlowMultiWidget/components/Block.vue +107 -0
- package/samples/FlowMultiWidget/components/FlowPage.vue +60 -0
- package/samples/FlowMultiWidget/components/Item.vue +103 -0
- package/samples/FlowMultiWidget/components/MenuItem.vue +72 -0
- package/samples/FlowMultiWidget/components/MyMenu.vue +90 -0
- package/samples/FlowMultiWidget/data.js +446 -0
- package/samples/HashHistory/App.vue +124 -0
- package/samples/HashHistory/components/HorizontalButtonList.vue +114 -0
- package/samples/HashHistory/components/Item.vue +74 -0
- package/samples/HashHistory/router.js +30 -0
- package/samples/HashHistory/views/BasePage.vue +19 -0
- package/samples/HashHistory/views/MainPage.vue +68 -0
- package/samples/HashHistory/views/SubPage.vue +79 -0
- package/samples/HashHistory/views/SubPageFirst.vue +10 -0
- package/samples/HashHistory/views/SubPageSecond.vue +10 -0
- package/samples/LongImage/App.vue +96 -0
- package/samples/LongImage/Button.vue +153 -0
- package/samples/LongImage/LongImageScroll.vue +127 -0
- package/samples/LongImage/Scroll.vue +16 -0
- package/samples/LongImage/assets/1280x7200.jpg +0 -0
- package/samples/LongText/App.vue +111 -0
- package/samples/LongText/Button.vue +153 -0
- package/samples/LongText/LongTextScroll.vue +225 -0
- package/samples/LongText/Scroll.vue +16 -0
- package/samples/Preload/App.vue +146 -0
- package/samples/Preload/data.js +23 -0
- package/samples/Preload/images/awesomeface.png +0 -0
- package/samples/Preload/images/cat.jpg +0 -0
- package/samples/Preload/images/rank.png +0 -0
- package/samples/Preload/images/rank_focus.png +0 -0
- package/samples/Preload/images/rule.png +0 -0
- package/samples/Preload/images/rule_focus.png +0 -0
- package/samples/Preload/images/start.png +0 -0
- package/samples/Preload/images/start_focus.png +0 -0
- package/samples/Preload/preloadItem.vue +22 -0
- package/samples/QrcodeDemo/App.vue +73 -0
- package/samples/SimpleWidgetDemo/App.vue +204 -0
- package/samples/SimpleWidgetDemo/Item.vue +83 -0
- 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/border.png +0 -0
- package/samples/SimpleWidgetDemo/components/ContentItem.vue +412 -0
- package/samples/SimpleWidgetDemo/components/MyTab.vue +117 -0
- package/samples/SimpleWidgetDemo/data.js +110 -0
- package/samples/SprayView/App.vue +270 -0
- package/samples/SprayView/assets/snow.png +0 -0
- package/samples/SpriteImage/App.vue +174 -0
- package/samples/SpriteImage/images/cat_run.png +0 -0
- package/samples/SpriteImage/images/egg_break.json +116 -0
- package/samples/SpriteImage/images/egg_break.png +0 -0
- package/samples/SpriteImage/images/sprite.png +0 -0
- package/samples/TextBox/App.vue +179 -0
- package/samples/TextBox/RenderCenter.vue +109 -0
- package/samples/TextBox/RenderLeft.vue +109 -0
- package/samples/TextBox/RenderOneLine.vue +120 -0
- package/samples/TextBox/RenderRight.vue +107 -0
- package/samples/TextShadowDemo/App.vue +98 -0
- package/samples/TextureSize/App.vue +142 -0
- package/samples/TextureSize/bmpDemo.bmp +0 -0
- package/samples/TextureSize/jpegDemo.jpeg +0 -0
- package/samples/TextureSize/jpgDemo.jpg +0 -0
- package/samples/TextureSize/pngDemo.png +0 -0
- package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +118 -0
- package/samples/ThrowMoveDemo/App.vue +114 -0
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +116 -0
- package/samples/ThrowMoveDemo/TargetDemo.vue +117 -0
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +122 -0
- package/samples/TransitPage/App.vue +41 -0
- package/samples/VideoDemo/App.vue +137 -0
- package/samples/VideoDemo/components/Button.vue +69 -0
- package/samples/VideoDemo/components/Controllor.vue +195 -0
- package/samples/VideoDemo/components/VideoFrame.vue +152 -0
- package/scripts/git-commit-empty.js +21 -0
- package/scripts/install-local-packages.js +121 -0
- package/scripts/make-js.sh +181 -0
- package/scripts/post-build.js +132 -0
- package/scripts/post-install.js +127 -0
- package/scripts/pre-pack.js +2 -0
- package/scripts/run-android.js +64 -0
- package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
- package/utils/JsViewEngineWidget/index.d.ts +32 -0
- package/utils/JsViewEngineWidget/index.js +6 -0
- package/utils/JsViewVueTools/DebugContentShellJBridge.js +16 -0
- package/utils/JsViewVueTools/DebugTool.js +21 -0
- package/utils/JsViewVueTools/DefaultKeyMap.js +12 -0
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +73 -0
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +128 -0
- package/utils/JsViewVueTools/JsvHashHistory.js +112 -0
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -0
- package/utils/JsViewVueTools/JsvStyleClass.js +290 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +148 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +55 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +29 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +124 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js +11 -0
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +64 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +427 -0
- package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +179 -0
- package/utils/JsViewVueWidget/JsvApic/index.js +17 -0
- package/utils/JsViewVueWidget/JsvMarquee.vue +197 -0
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +92 -0
- package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -0
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +351 -0
- package/utils/JsViewVueWidget/JsvPreload/index.js +21 -0
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -0
- package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -0
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +140 -0
- package/utils/JsViewVueWidget/JsvSpray/index.js +15 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +448 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +57 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -0
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +35 -0
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +495 -0
- package/utils/JsViewVueWidget/JsvSwiper/index.js +10 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +35 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +404 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/index.js +10 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +111 -0
- package/utils/JsViewVueWidget/JsvVideo.vue +36 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Options, Vue } from "vue-class-component";
|
|
3
|
+
import { jJsvRuntimeBridge } from "jsview/utils/JsViewVueTools/JsvRuntimeBridge";
|
|
4
|
+
import { router, routeList } from './router.js'
|
|
5
|
+
import { useRouter, useRoute, Router } from 'vue-router'
|
|
6
|
+
|
|
7
|
+
@Options({
|
|
8
|
+
props: {
|
|
9
|
+
routePath: String
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
class App extends Vue {
|
|
13
|
+
constructor(props: any) {
|
|
14
|
+
super(props)
|
|
15
|
+
|
|
16
|
+
let currentRouter: Router;
|
|
17
|
+
|
|
18
|
+
// props.routePath在DemoHomepage中被设置, 此处作为内嵌router使用.
|
|
19
|
+
// 此时已经有router, 则作为children动态添加到当前route
|
|
20
|
+
if(props.routePath) {
|
|
21
|
+
const currentRoute = useRoute()
|
|
22
|
+
currentRouter = useRouter()
|
|
23
|
+
|
|
24
|
+
let redirectPath; // 自动跳转路径
|
|
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;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.watchRouterChanged(currentRouter);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Override
|
|
44
|
+
mounted() {
|
|
45
|
+
// 调试接口,对接JSCenter平台去掉启动图的处理
|
|
46
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private onRequestFocus(branchName: string) {
|
|
50
|
+
this.topRef.findBlockByname(branchName)?.requestFocus();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private watchRouterChanged(route: Router) {
|
|
54
|
+
route.afterEach(() => {
|
|
55
|
+
this.displayUrl = window.location.href;
|
|
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;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default App;
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<div class="root">
|
|
75
|
+
<div class="address">
|
|
76
|
+
当前URL: {{ displayUrl }}
|
|
77
|
+
</div>
|
|
78
|
+
<div class="split" />
|
|
79
|
+
<jsv-focus-block ref="topRef">
|
|
80
|
+
<!-- 这种router-view的写法可以获取到component的ref,vue标准写法 -->
|
|
81
|
+
<router-view v-slot="{ Component }">
|
|
82
|
+
<component :is="Component"
|
|
83
|
+
ref="routePage"
|
|
84
|
+
class="router"
|
|
85
|
+
@requestFocus="onRequestFocus"
|
|
86
|
+
/>
|
|
87
|
+
</router-view>
|
|
88
|
+
</jsv-focus-block>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<style scoped>
|
|
93
|
+
.root {
|
|
94
|
+
left: 0;
|
|
95
|
+
top: 0;
|
|
96
|
+
width: 1280;
|
|
97
|
+
height: 1080;
|
|
98
|
+
background-color: rgb(222,211,140)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.address {
|
|
102
|
+
left: 40;
|
|
103
|
+
top: 40;
|
|
104
|
+
width: 1200;
|
|
105
|
+
height: 200;
|
|
106
|
+
font-size: 20;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.split {
|
|
110
|
+
left: 40;
|
|
111
|
+
top: 150;
|
|
112
|
+
width: 1200;
|
|
113
|
+
height: 3;
|
|
114
|
+
background-color: #00F000;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.router {
|
|
118
|
+
left:0;
|
|
119
|
+
top:150;
|
|
120
|
+
width: 1920;
|
|
121
|
+
height: 930;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { JsvFocusEvent } from "jsview/utils/JsViewEngineWidget";
|
|
3
|
+
import { Options, Vue } from "vue-class-component";
|
|
4
|
+
import Item from "./Item.vue";
|
|
5
|
+
|
|
6
|
+
@Options({
|
|
7
|
+
props: {
|
|
8
|
+
style: Object,
|
|
9
|
+
buttonConfig: Object,
|
|
10
|
+
onButtonClick: Function,
|
|
11
|
+
onBack: Function,
|
|
12
|
+
},
|
|
13
|
+
components: {
|
|
14
|
+
Item,
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class HorizontalButtonList extends Vue {
|
|
20
|
+
constructor(props: object) {
|
|
21
|
+
super(props);
|
|
22
|
+
|
|
23
|
+
this.listSize = this.computeSize(props);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private computeSize(props: any) : object {
|
|
27
|
+
let listLeft = 0;
|
|
28
|
+
const listWidth = (this.buttonWidth + this.buttonGap) * props.buttonConfig.length;
|
|
29
|
+
|
|
30
|
+
// 根据maxWidth,计算buttons的左边位置
|
|
31
|
+
const widthCenter = listWidth - this.buttonGap; // 减去最后一个元素的gap
|
|
32
|
+
if (widthCenter < this.maxWidth) {
|
|
33
|
+
listLeft = Math.floor((this.maxWidth - widthCenter) / 2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let listSize = {
|
|
37
|
+
left: listLeft,
|
|
38
|
+
width: listWidth,
|
|
39
|
+
height: this.buttonHeight,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return listSize;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private onKeyDown(ev: JsvFocusEvent) {
|
|
46
|
+
if(ev.keyCode === 13) { // Enter
|
|
47
|
+
this.onButtonClick?.(this.focusedItemIndex);
|
|
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;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private listSize: object;
|
|
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;
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<div :style="style">
|
|
94
|
+
<jsv-focus-block
|
|
95
|
+
:style="{
|
|
96
|
+
left: listSize.left,
|
|
97
|
+
width: listSize.width + listPadding * 2,
|
|
98
|
+
height: listSize.height + listPadding * 2,
|
|
99
|
+
}"
|
|
100
|
+
:onKeyDown="onKeyDown"
|
|
101
|
+
>
|
|
102
|
+
<Item v-for="(item,index) in buttonConfig" :key="index"
|
|
103
|
+
:style="{ left: (buttonWidth+10)*index, width:buttonWidth, height:buttonHeight }"
|
|
104
|
+
:name="index.toString()"
|
|
105
|
+
:autoFocus="index === 0"
|
|
106
|
+
>
|
|
107
|
+
{{ item.name }}
|
|
108
|
+
</Item>
|
|
109
|
+
</jsv-focus-block>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<style>
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Options, Vue } from "vue-class-component";
|
|
3
|
+
|
|
4
|
+
@Options({
|
|
5
|
+
props: {
|
|
6
|
+
style: Object,
|
|
7
|
+
name: String,
|
|
8
|
+
autoFocus: Boolean
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
class Item extends Vue {
|
|
13
|
+
constructor(props: object) {
|
|
14
|
+
super(props);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
onFocus() {
|
|
18
|
+
this.hasFocused = true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onBlur() {
|
|
22
|
+
this.hasFocused = false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getFocusStyle() {
|
|
26
|
+
return {
|
|
27
|
+
width: this.style.width + 10,
|
|
28
|
+
height: this.style.height + 10,
|
|
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;
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<jsv-focus-block :name="name" :autoFocus="autoFocus?'':undefined"
|
|
51
|
+
:onFocus="onFocus" :onBlur="onBlur"
|
|
52
|
+
>
|
|
53
|
+
<div :style="style">
|
|
54
|
+
<div class="focus" :style="getFocusStyle()" v-if="hasFocused" />
|
|
55
|
+
<div class="item" :style="getItemStyle()">
|
|
56
|
+
<slot/>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</jsv-focus-block>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<style scoped>
|
|
63
|
+
.focus {
|
|
64
|
+
top: -5;
|
|
65
|
+
left: -5;
|
|
66
|
+
background-color: #0000FF;
|
|
67
|
+
}
|
|
68
|
+
.item {
|
|
69
|
+
text-align: center;
|
|
70
|
+
font-size: 30;
|
|
71
|
+
color: #000000;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRouter } from "vue-router";
|
|
2
|
+
import { createJsvHashHistory } from "jsview/utils/JsViewVueTools/JsvHashHistory";
|
|
3
|
+
|
|
4
|
+
const routeList = [
|
|
5
|
+
// 功能实例
|
|
6
|
+
{
|
|
7
|
+
name: "Home",
|
|
8
|
+
path: "/",
|
|
9
|
+
redirect: "/__MainJsvApp/MainPage",
|
|
10
|
+
}, {
|
|
11
|
+
name: "MainPage",
|
|
12
|
+
path: "/__MainJsvApp/MainPage",
|
|
13
|
+
component: () => import('./views/MainPage')
|
|
14
|
+
}, {
|
|
15
|
+
name: "SubPageFirst",
|
|
16
|
+
path: "/__MainJsvApp/SubPageFirst",
|
|
17
|
+
component: () => import('./views/SubPageFirst')
|
|
18
|
+
}, {
|
|
19
|
+
name: "SubPageSecond",
|
|
20
|
+
path: "/__MainJsvApp/SubPageSecond",
|
|
21
|
+
component: () => import('./views/SubPageSecond')
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const router = createRouter({
|
|
26
|
+
history: createJsvHashHistory(),
|
|
27
|
+
routes: routeList,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export { router, routeList }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Vue } from "vue-class-component";
|
|
3
|
+
|
|
4
|
+
export default class BasePage extends Vue {
|
|
5
|
+
constructor(props: any) {
|
|
6
|
+
super(props);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
mounted() {
|
|
10
|
+
// this.$emit('requestFocus', this.branchName);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
onBack() {
|
|
14
|
+
this.$router?.go(-1); // 有router时,回退
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected branchName?: string;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Options } from "vue-class-component";
|
|
3
|
+
import HorizontalButtonList from "../components/HorizontalButtonList.vue";
|
|
4
|
+
import BasePage from "./BasePage.vue"
|
|
5
|
+
|
|
6
|
+
@Options({
|
|
7
|
+
components: {
|
|
8
|
+
HorizontalButtonList
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
export default class MainPage extends BasePage {
|
|
12
|
+
constructor(props: any) {
|
|
13
|
+
super(props);
|
|
14
|
+
|
|
15
|
+
this.branchName = "./MainPage.ButtonList"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private getButtonListConfig() {
|
|
19
|
+
const buttonListConfig = [{
|
|
20
|
+
name: "启动子界面-First",
|
|
21
|
+
route: {
|
|
22
|
+
path: "SubPageFirst",
|
|
23
|
+
query: { from: 'main' },
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
name: "启动子界面-Second",
|
|
27
|
+
route: {
|
|
28
|
+
path: "SubPageSecond",
|
|
29
|
+
query: { from: 'main' },
|
|
30
|
+
}
|
|
31
|
+
}];
|
|
32
|
+
|
|
33
|
+
return buttonListConfig;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private onButtonClick(idx: number) {
|
|
37
|
+
const buttonListConfig = this.getButtonListConfig();
|
|
38
|
+
const config = buttonListConfig[idx];
|
|
39
|
+
console.log("Jump page to: " + config.name)
|
|
40
|
+
this.$router.push(config.route);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div>
|
|
47
|
+
<div class="title">
|
|
48
|
+
这是主界面
|
|
49
|
+
</div>
|
|
50
|
+
<HorizontalButtonList
|
|
51
|
+
:style="{top: 330}"
|
|
52
|
+
:buttonConfig="getButtonListConfig()"
|
|
53
|
+
:onButtonClick="onButtonClick"
|
|
54
|
+
:onBack="onBack"
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style scoped>
|
|
60
|
+
.title {
|
|
61
|
+
top: 100;
|
|
62
|
+
width: 1280;
|
|
63
|
+
height: 100;
|
|
64
|
+
line-height: 100px;
|
|
65
|
+
text-align: center;
|
|
66
|
+
font-size: 55;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Options } from "vue-class-component";
|
|
3
|
+
import HorizontalButtonList from "../components/HorizontalButtonList.vue";
|
|
4
|
+
import BasePage from "./BasePage.vue"
|
|
5
|
+
|
|
6
|
+
@Options({
|
|
7
|
+
components: {
|
|
8
|
+
HorizontalButtonList
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
export default class SubPage extends BasePage {
|
|
12
|
+
constructor(props: any, name: string, jumpTo: string) {
|
|
13
|
+
super(props);
|
|
14
|
+
|
|
15
|
+
this.name = name;
|
|
16
|
+
this.jumpTo = jumpTo;
|
|
17
|
+
this.branchName = "./ButtonList/SubPage" + this.name;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private getButtonListConfig() {
|
|
21
|
+
const buttonListConfig = [{
|
|
22
|
+
name: "跳转子界面-" + this.jumpTo,
|
|
23
|
+
route: {
|
|
24
|
+
path: "SubPage" + this.jumpTo,
|
|
25
|
+
query: { from: 'sub' + this.name },
|
|
26
|
+
}
|
|
27
|
+
}];
|
|
28
|
+
|
|
29
|
+
return buttonListConfig;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private onButtonClick(idx: number) {
|
|
33
|
+
const buttonListConfig = this.getButtonListConfig();
|
|
34
|
+
const config = buttonListConfig[idx];
|
|
35
|
+
console.log("Jump page to: " + config.name)
|
|
36
|
+
this.$router.push(config.route);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private readonly name: string;
|
|
40
|
+
private readonly jumpTo: string;
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div>
|
|
46
|
+
<div class="title">
|
|
47
|
+
这是子界面{{name}}
|
|
48
|
+
</div>
|
|
49
|
+
<HorizontalButtonList
|
|
50
|
+
:style="{top: 230}"
|
|
51
|
+
:buttonConfig="getButtonListConfig()"
|
|
52
|
+
:onButtonClick="onButtonClick"
|
|
53
|
+
:onBack="onBack"
|
|
54
|
+
/>
|
|
55
|
+
<div class="tip">
|
|
56
|
+
按返回键返回前一页
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<style scoped>
|
|
62
|
+
.title {
|
|
63
|
+
top: 100;
|
|
64
|
+
width: 1280;
|
|
65
|
+
height: 100;
|
|
66
|
+
line-height: 100px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
font-size: 55;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.tip {
|
|
72
|
+
top: 330;
|
|
73
|
+
width: 1280;
|
|
74
|
+
height: 100;
|
|
75
|
+
line-height: 100px;
|
|
76
|
+
text-align: center;
|
|
77
|
+
font-size: 30;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
*
|
|
3
|
+
* 【界面概述】
|
|
4
|
+
* 带下拉条的长图片展示样例
|
|
5
|
+
*
|
|
6
|
+
* 【控件介绍】
|
|
7
|
+
* SimpleWidget:见simpleMetrowidget
|
|
8
|
+
*
|
|
9
|
+
* 【技巧说明】
|
|
10
|
+
* Q: 如何让图片的高度自适应?
|
|
11
|
+
* A: 使用img元素,并且style中高度不设置即可
|
|
12
|
+
* 通过element.clientHeight获取渲染后的自动高度,以决定滚动轴的总高度
|
|
13
|
+
*
|
|
14
|
+
* Q: 如何知道图片加载完成?
|
|
15
|
+
* A: 为img标签追加OnLoad回调函数来接收图片加载完成的消息
|
|
16
|
+
*
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { Options, Vue } from "vue-class-component";
|
|
21
|
+
import LongImageScroll from "./LongImageScroll.vue";
|
|
22
|
+
import Button from "./Button.vue";
|
|
23
|
+
import LongImageSource from "./assets/1280x7200.jpg";
|
|
24
|
+
|
|
25
|
+
interface KeyEvent {
|
|
26
|
+
keyCode: Number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Options({
|
|
30
|
+
components: {
|
|
31
|
+
LongImageScroll,
|
|
32
|
+
Button,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
class App extends Vue {
|
|
36
|
+
constructor(props: any) {
|
|
37
|
+
super(props);
|
|
38
|
+
}
|
|
39
|
+
private LongImageSource: String = LongImageSource;
|
|
40
|
+
|
|
41
|
+
onKeyDown(ev: KeyEvent): Boolean {
|
|
42
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
43
|
+
this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export default App;
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<jsv-focus-block
|
|
54
|
+
autoFocus
|
|
55
|
+
:onAction="{
|
|
56
|
+
onKeyDown: onKeyDown,
|
|
57
|
+
}"
|
|
58
|
+
>
|
|
59
|
+
<div
|
|
60
|
+
:style="{
|
|
61
|
+
textAlign: 'center',
|
|
62
|
+
fontSize: '30px',
|
|
63
|
+
lineHeight: '50px',
|
|
64
|
+
color: '#ffffff',
|
|
65
|
+
left: 100,
|
|
66
|
+
top: 20,
|
|
67
|
+
width: 1000,
|
|
68
|
+
height: 50,
|
|
69
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
70
|
+
}"
|
|
71
|
+
>
|
|
72
|
+
可加载长或宽超过2048px的图片
|
|
73
|
+
</div>
|
|
74
|
+
<div :style="{ left: 100, top: 100 }">
|
|
75
|
+
<LongImageScroll
|
|
76
|
+
:style="{ width: 1000, height: 500, backgroundColor: '#EEEEEE' }"
|
|
77
|
+
:imageSrc="LongImageSource"
|
|
78
|
+
:scrollBlockStyle="{
|
|
79
|
+
width: 10,
|
|
80
|
+
height: 30,
|
|
81
|
+
backgroundColor: '#555555',
|
|
82
|
+
}"
|
|
83
|
+
:scrollStyle="{
|
|
84
|
+
left: 1005,
|
|
85
|
+
width: 10,
|
|
86
|
+
height: 500,
|
|
87
|
+
backgroundColor: '#DDDDDD',
|
|
88
|
+
}"
|
|
89
|
+
:step="60"
|
|
90
|
+
/>
|
|
91
|
+
<div :style="{ left: 400, top: 550 }">
|
|
92
|
+
<Button />
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</jsv-focus-block>
|
|
96
|
+
</template>
|