@shijiu/jsview-vue 1.9.727 → 1.9.747
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/index.d.ts +4 -1
- package/index.js +4 -1
- package/package.json +5 -16
- package/samples/AnimPicture/App.vue +0 -207
- 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 +0 -134
- 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 +0 -38
- package/samples/Basic/components/FontStyle.css +0 -16
- package/samples/Basic/components/anim/AnimGroup.vue +0 -66
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +0 -119
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +0 -52
- package/samples/Basic/components/anim/AnimTransition.vue +0 -157
- package/samples/Basic/components/div/DivBackground.vue +0 -44
- package/samples/Basic/components/div/DivClip.vue +0 -159
- package/samples/Basic/components/div/DivCssScoped.vue +0 -20
- package/samples/Basic/components/div/DivCssVar.vue +0 -53
- package/samples/Basic/components/div/DivGroup1.vue +0 -47
- package/samples/Basic/components/div/DivGroup2.vue +0 -65
- package/samples/Basic/components/div/DivLayout.vue +0 -70
- package/samples/Basic/components/div/DivRadius.vue +0 -65
- package/samples/Basic/components/div/DivTransform.vue +0 -32
- package/samples/Basic/components/img/ImageGroup.vue +0 -31
- package/samples/Basic/components/img/ImgLayout.vue +0 -41
- package/samples/Basic/components/panel/Panel1.vue +0 -55
- package/samples/Basic/components/panel/Panel2.vue +0 -31
- package/samples/Basic/components/panel/TitleBar.vue +0 -29
- package/samples/Basic/components/text/TextAlign.vue +0 -66
- package/samples/Basic/components/text/TextEmoji.vue +0 -26
- package/samples/Basic/components/text/TextFontStyle.vue +0 -89
- package/samples/Basic/components/text/TextGroup1.vue +0 -49
- package/samples/Basic/components/text/TextGroup2.vue +0 -28
- package/samples/Basic/components/text/TextOverflow.vue +0 -110
- package/samples/BasicFocusControl/App.vue +0 -104
- package/samples/BasicFocusControl/components/BaseBlock.vue +0 -50
- package/samples/BasicFocusControl/components/MainArea.vue +0 -83
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +0 -17
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +0 -27
- package/samples/BasicFocusControl/components/SideBar.vue +0 -58
- package/samples/BasicFocusControl/components/SideBarBlock.vue +0 -27
- package/samples/Collision/App.vue +0 -452
- package/samples/ColorSpace/App.vue +0 -126
- package/samples/DemoHomepage/App.vue +0 -27
- package/samples/DemoHomepage/components/BodyFrame.vue +0 -95
- package/samples/DemoHomepage/components/Dialog.vue +0 -94
- package/samples/DemoHomepage/components/Item.vue +0 -77
- package/samples/DemoHomepage/components/TabFrame.vue +0 -85
- package/samples/DemoHomepage/router.js +0 -196
- package/samples/DemoHomepage/views/Homepage.vue +0 -195
- package/samples/FilterDemo/AnimatePic.vue +0 -58
- package/samples/FilterDemo/App.vue +0 -159
- package/samples/FilterDemo/VideoLayer.vue +0 -62
- package/samples/FlipCard/App.vue +0 -71
- package/samples/FlipCard/FlipCard.vue +0 -118
- package/samples/FlipCard/assets/blue_egg.png +0 -0
- package/samples/FlipCard/assets/red_egg.png +0 -0
- package/samples/FlipCard/data.js +0 -13
- package/samples/GridDemo/App.vue +0 -215
- package/samples/GridDemo/ButtonBlock.vue +0 -112
- package/samples/GridDemo/FocusItem.vue +0 -37
- package/samples/GridDemo/Item.vue +0 -93
- package/samples/HashHistory/App.vue +0 -115
- package/samples/HashHistory/components/HorizontalButtonList.vue +0 -91
- package/samples/HashHistory/components/Item.vue +0 -60
- package/samples/HashHistory/router.js +0 -41
- package/samples/HashHistory/views/MainPage.vue +0 -57
- package/samples/HashHistory/views/SubPage.vue +0 -66
- package/samples/ImpactStop/App.vue +0 -435
- package/samples/Input/App.vue +0 -164
- package/samples/Input/FullKeyboard.vue +0 -87
- package/samples/Input/InputPanel.vue +0 -131
- package/samples/Input/KeyboardItem.vue +0 -58
- package/samples/LongImage/App.vue +0 -80
- package/samples/LongImage/Button.vue +0 -58
- package/samples/LongImage/ButtonItem.vue +0 -44
- package/samples/LongImage/LongImageScroll.vue +0 -92
- package/samples/LongImage/Scroll.vue +0 -14
- package/samples/LongImage/assets/1280x7200.jpg +0 -0
- package/samples/LongText/App.vue +0 -96
- package/samples/LongText/Button.vue +0 -51
- package/samples/LongText/ButtonItem.vue +0 -44
- package/samples/LongText/LongTextScroll.vue +0 -192
- package/samples/LongText/Scroll.vue +0 -14
- package/samples/Marquee/App.vue +0 -247
- package/samples/Marquee/longText.js +0 -14
- package/samples/MaskClip/App.vue +0 -122
- package/samples/MaskClip/images/mask-025/config.json +0 -29
- package/samples/MaskClip/images/mask-025/res/1.png +0 -0
- package/samples/MaskClip/images/mask-025/res/2.png +0 -0
- package/samples/MaskClip/images/mask-025/res/3.png +0 -0
- package/samples/MaskClip/images/mask-025/res/4.png +0 -0
- package/samples/MaskClip/images/mask-025/res/icon.png +0 -0
- package/samples/MaskClip/images/mask-025/res/stroke.png +0 -0
- package/samples/MaskClip/images/php.jpg +0 -0
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +0 -90
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +0 -83
- package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +0 -89
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Item.vue +0 -85
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +0 -210
- package/samples/MetroWidgetDemos/PerformanceTest/Item.vue +0 -90
- package/samples/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/border.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +0 -386
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +0 -129
- package/samples/MetroWidgetDemos/PerformanceTest/data.js +0 -45
- package/samples/MetroWidgetDemos/PingPong/App.vue +0 -135
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +0 -73
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +0 -62
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +0 -84
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +0 -214
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
- package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
- package/samples/MetroWidgetDemos/WidgetItem.vue +0 -89
- package/samples/MetroWidgetDemos/data.js +0 -205
- package/samples/NinePatchDemo/App.vue +0 -145
- package/samples/NinePatchDemo/Item.vue +0 -69
- package/samples/NinePatchDemo/assets/border.png +0 -0
- package/samples/Preload/App.vue +0 -135
- package/samples/Preload/Item.vue +0 -32
- package/samples/Preload/data.js +0 -23
- 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/QrcodeDemo/App.vue +0 -68
- package/samples/ScaleDownNeon/App.vue +0 -107
- package/samples/SoundPool/App.vue +0 -134
- package/samples/SoundPool/bgmusic.mp3 +0 -0
- package/samples/SoundPool/coin.mp3 +0 -0
- package/samples/SoundPool/jump.mp3 +0 -0
- package/samples/SoundPool/lose.mp3 +0 -0
- package/samples/SoundPool/run.mp3 +0 -0
- package/samples/SprayView/App.vue +0 -272
- package/samples/SprayView/assets/snow.png +0 -0
- package/samples/SpriteImage/App.vue +0 -173
- package/samples/SpriteImage/images/cat_run.png +0 -0
- package/samples/SpriteImage/images/egg_break.json +0 -116
- package/samples/SpriteImage/images/egg_break.png +0 -0
- package/samples/SpriteImage/images/sprite.png +0 -0
- package/samples/TextBox/App.vue +0 -91
- package/samples/TextBox/RenderCenter.vue +0 -133
- package/samples/TextBox/RenderLeft.vue +0 -138
- package/samples/TextBox/RenderOneLine.vue +0 -101
- package/samples/TextBox/RenderRight.vue +0 -131
- package/samples/TextShadowDemo/App.vue +0 -91
- package/samples/TextureAnimation/App.vue +0 -336
- package/samples/TextureAnimation/App2.vue +0 -111
- 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/TextureAnimation/assets/php.jpg +0 -0
- package/samples/TextureAnimation/assets/php2.png +0 -0
- package/samples/TextureAnimation/assets/swipLight.png +0 -0
- package/samples/TextureSize/App.vue +0 -132
- 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 +0 -116
- package/samples/ThrowMoveDemo/App.vue +0 -114
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +0 -115
- package/samples/ThrowMoveDemo/TargetDemo.vue +0 -116
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +0 -121
- package/samples/TouchSample/App.vue +0 -136
- package/samples/TouchSample/Item.vue +0 -103
- package/samples/TouchSample/MetroWidgetHorizontal.vue +0 -144
- package/samples/TouchSample/MetroWidgetVertical.vue +0 -144
- package/samples/TouchSample/TouchContainerHorizontal.vue +0 -160
- package/samples/TouchSample/TouchContainerVertical.vue +0 -160
- package/samples/TouchSample/data.js +0 -81
- package/samples/TransitPage/App.vue +0 -29
- package/samples/VideoDemo/App.vue +0 -121
- package/samples/VideoDemo/components/Button.vue +0 -58
- package/samples/VideoDemo/components/Controllor.vue +0 -197
- package/samples/VideoDemo/components/VideoFrame.vue +0 -140
- package/samples/VisibleSensorDemo/App.vue +0 -234
- package/samples/assets/bmpDemo.bmp +0 -0
- package/samples/assets/jpegDemo.jpeg +0 -0
- package/samples/assets/pngDemo.png +0 -0
- package/samples/assets/pngNoAlphaDemo.png +0 -0
- package/samples/assets/webpDemo.webp +0 -0
- package/tsconfig.json +0 -47
- package/utils/index.d.ts +0 -3
- package/utils/index.js +0 -10
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-01-25 10:33:07
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-09-02 13:44:41
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script>
|
|
9
|
-
import FullKeyboard from "./FullKeyboard.vue";
|
|
10
|
-
import { EdgeDirection, JsvInput, useFocusHub } from "jsview";
|
|
11
|
-
import { ref, shallowRef } from "vue";
|
|
12
|
-
|
|
13
|
-
const blurColor = "#AAAAAA";
|
|
14
|
-
const focusColor = "#FFFF00";
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
components: {
|
|
18
|
-
FullKeyboard,
|
|
19
|
-
JsvInput,
|
|
20
|
-
},
|
|
21
|
-
props: {
|
|
22
|
-
name: String,
|
|
23
|
-
type: Number,
|
|
24
|
-
textAlign: String,
|
|
25
|
-
placeHolder: String,
|
|
26
|
-
onEdge: Function,
|
|
27
|
-
},
|
|
28
|
-
setup() {
|
|
29
|
-
return {
|
|
30
|
-
showCursor: ref(false),
|
|
31
|
-
focusHub: useFocusHub(),
|
|
32
|
-
cursorColor: ref(blurColor),
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
methods: {
|
|
36
|
-
_onFocus() {
|
|
37
|
-
this.showCursor = true;
|
|
38
|
-
this.cursorColor = blurColor;
|
|
39
|
-
this.focusHub.setFocus(`${this.name}/keyboard`);
|
|
40
|
-
},
|
|
41
|
-
_onBlur() {
|
|
42
|
-
console.log("testtest onblur");
|
|
43
|
-
this.showCursor = false;
|
|
44
|
-
this.cursorColor = blurColor;
|
|
45
|
-
},
|
|
46
|
-
_keyboardOnClick(item) {
|
|
47
|
-
const char = item.content;
|
|
48
|
-
if (char === "删除") {
|
|
49
|
-
this.$refs.input?.delete();
|
|
50
|
-
} else if (char === "清空") {
|
|
51
|
-
this.$refs.input?.clear();
|
|
52
|
-
} else {
|
|
53
|
-
this.$refs.input?.add(char);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
_keyboardOnEdge(edgeInfo) {
|
|
57
|
-
if (edgeInfo.direction === EdgeDirection.top) {
|
|
58
|
-
this.focusHub.setFocus(`${this.name}/etext`);
|
|
59
|
-
this.cursorColor = focusColor;
|
|
60
|
-
} else {
|
|
61
|
-
this.onEdge?.(edgeInfo);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
_onTextChange(str) {
|
|
65
|
-
console.log(this.name + " text change:", str);
|
|
66
|
-
},
|
|
67
|
-
_onTextOverflow() {
|
|
68
|
-
console.log(this.name + " text overflow.");
|
|
69
|
-
},
|
|
70
|
-
_inputOnEdge(edgeInfo) {
|
|
71
|
-
if (edgeInfo.direction === EdgeDirection.bottom) {
|
|
72
|
-
this.focusHub.setFocus(`${this.name}/keyboard`);
|
|
73
|
-
this.cursorColor = blurColor;
|
|
74
|
-
} else {
|
|
75
|
-
this.onEdge?.(edgeInfo);
|
|
76
|
-
}
|
|
77
|
-
return true;
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<template>
|
|
84
|
-
<jsv-focus-block
|
|
85
|
-
:name="name"
|
|
86
|
-
ref="focusNode"
|
|
87
|
-
:onAction="{
|
|
88
|
-
onFocus: _onFocus,
|
|
89
|
-
onBlur: _onBlur,
|
|
90
|
-
}"
|
|
91
|
-
>
|
|
92
|
-
<div
|
|
93
|
-
:style="{
|
|
94
|
-
left: 50,
|
|
95
|
-
top: 50,
|
|
96
|
-
width: 150,
|
|
97
|
-
height: 40,
|
|
98
|
-
backgroundColor: '#33334f',
|
|
99
|
-
}"
|
|
100
|
-
/>
|
|
101
|
-
<jsv-input
|
|
102
|
-
:name="`${this.name}/etext`"
|
|
103
|
-
ref="input"
|
|
104
|
-
:type="type"
|
|
105
|
-
:left="50"
|
|
106
|
-
:top="50"
|
|
107
|
-
:height="40"
|
|
108
|
-
:width="150"
|
|
109
|
-
:placeholder="placeHolder"
|
|
110
|
-
:cursorShow="showCursor"
|
|
111
|
-
:fontStyle="{
|
|
112
|
-
fontSize: 28,
|
|
113
|
-
color: '#ffff00',
|
|
114
|
-
textAlign: textAlign,
|
|
115
|
-
}"
|
|
116
|
-
:onEdge="_inputOnEdge"
|
|
117
|
-
:cursorWidth="2"
|
|
118
|
-
:onTextChange="_onTextChange"
|
|
119
|
-
:onTextOverflow="_onTextOverflow"
|
|
120
|
-
:cursorColor="cursorColor"
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
<div :style="{ top: 100 }">
|
|
124
|
-
<full-keyboard
|
|
125
|
-
:name="`${this.name}/keyboard`"
|
|
126
|
-
:onClick="_keyboardOnClick"
|
|
127
|
-
:onEdge="_keyboardOnEdge"
|
|
128
|
-
/>
|
|
129
|
-
</div>
|
|
130
|
-
</jsv-focus-block>
|
|
131
|
-
</template>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
props: {
|
|
4
|
-
data: Object,
|
|
5
|
-
query: Object,
|
|
6
|
-
onEdge: Function,
|
|
7
|
-
onAction: Object,
|
|
8
|
-
onClick: Function,
|
|
9
|
-
},
|
|
10
|
-
data() {
|
|
11
|
-
return {
|
|
12
|
-
focused: false,
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
computed: {
|
|
16
|
-
style() {
|
|
17
|
-
return {
|
|
18
|
-
width: this.data.width,
|
|
19
|
-
height: this.data.height,
|
|
20
|
-
fontSize: 20,
|
|
21
|
-
textAlign: "center",
|
|
22
|
-
lineHeight: this.data.height,
|
|
23
|
-
color: "#FFFFFF",
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
methods: {
|
|
28
|
-
_onFocus() {
|
|
29
|
-
this.focused = true;
|
|
30
|
-
},
|
|
31
|
-
_onBlur() {
|
|
32
|
-
this.focused = false;
|
|
33
|
-
},
|
|
34
|
-
_onClick() {
|
|
35
|
-
this.onClick(this.data);
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
created() {
|
|
39
|
-
this.onAction.register("onFocus", this._onFocus);
|
|
40
|
-
this.onAction.register("onBlur", this._onBlur);
|
|
41
|
-
this.onAction.register("onClick", this._onClick);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<div
|
|
48
|
-
v-if="focused"
|
|
49
|
-
:style="{
|
|
50
|
-
width: data.width,
|
|
51
|
-
height: data.height,
|
|
52
|
-
backgroundColor: '#00FF00',
|
|
53
|
-
}"
|
|
54
|
-
/>
|
|
55
|
-
<div ref="element" :style="style">
|
|
56
|
-
{{ data.content }}
|
|
57
|
-
</div>
|
|
58
|
-
</template>
|
|
@@ -1,80 +0,0 @@
|
|
|
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 setup>
|
|
20
|
-
import LongImageScroll from "./LongImageScroll.vue";
|
|
21
|
-
import Button from "./Button.vue";
|
|
22
|
-
import longImageSource from "./assets/1280x7200.jpg";
|
|
23
|
-
import { useRouter } from "vue-router";
|
|
24
|
-
|
|
25
|
-
const router = useRouter();
|
|
26
|
-
|
|
27
|
-
const onKeyDown = (ev) => {
|
|
28
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
29
|
-
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
};
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<template>
|
|
37
|
-
<jsv-focus-block
|
|
38
|
-
autoFocus
|
|
39
|
-
:onAction="{
|
|
40
|
-
onKeyDown: onKeyDown,
|
|
41
|
-
}"
|
|
42
|
-
>
|
|
43
|
-
<div
|
|
44
|
-
:style="{
|
|
45
|
-
textAlign: 'center',
|
|
46
|
-
fontSize: '30px',
|
|
47
|
-
lineHeight: '50px',
|
|
48
|
-
color: '#ffffff',
|
|
49
|
-
left: 100,
|
|
50
|
-
top: 20,
|
|
51
|
-
width: 1000,
|
|
52
|
-
height: 50,
|
|
53
|
-
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
54
|
-
}"
|
|
55
|
-
>
|
|
56
|
-
可加载长或宽超过2048px的图片
|
|
57
|
-
</div>
|
|
58
|
-
<div :style="{ left: 100, top: 100 }">
|
|
59
|
-
<LongImageScroll
|
|
60
|
-
:style="{ width: 1000, height: 500, backgroundColor: '#EEEEEE' }"
|
|
61
|
-
:imageSrc="longImageSource"
|
|
62
|
-
:scrollBlockStyle="{
|
|
63
|
-
width: 10,
|
|
64
|
-
height: 30,
|
|
65
|
-
backgroundColor: '#555555',
|
|
66
|
-
}"
|
|
67
|
-
:scrollStyle="{
|
|
68
|
-
left: 1005,
|
|
69
|
-
width: 10,
|
|
70
|
-
height: 500,
|
|
71
|
-
backgroundColor: '#DDDDDD',
|
|
72
|
-
}"
|
|
73
|
-
:step="60"
|
|
74
|
-
/>
|
|
75
|
-
<div :style="{ left: 400, top: 550 }">
|
|
76
|
-
<Button></Button>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</jsv-focus-block>
|
|
80
|
-
</template>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-08 15:18:02
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-08 17:47:25
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { ref, shallowRef } from "vue";
|
|
10
|
-
import { HORIZONTAL, MetroWidget, EdgeDirection, useFocusHub } from "jsview";
|
|
11
|
-
import ButtonItem from "./ButtonItem.vue";
|
|
12
|
-
|
|
13
|
-
const focusHub = useFocusHub();
|
|
14
|
-
const data = [
|
|
15
|
-
{
|
|
16
|
-
width: 100,
|
|
17
|
-
height: 50,
|
|
18
|
-
marginRight: 100,
|
|
19
|
-
content: "同意",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
width: 100,
|
|
23
|
-
height: 50,
|
|
24
|
-
content: "取消",
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const measures = (item) => {
|
|
29
|
-
return item;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const onEdge = (edgeInfo) => {
|
|
33
|
-
if (edgeInfo.direction == EdgeDirection.top) {
|
|
34
|
-
focusHub.setFocus("longImageScroll");
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<template>
|
|
40
|
-
<metro-widget
|
|
41
|
-
name="button"
|
|
42
|
-
:width="500"
|
|
43
|
-
:height="50"
|
|
44
|
-
:data="data"
|
|
45
|
-
:direction="HORIZONTAL"
|
|
46
|
-
:measures="measures"
|
|
47
|
-
:onEdge="onEdge"
|
|
48
|
-
>
|
|
49
|
-
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
50
|
-
<button-item
|
|
51
|
-
:data="data"
|
|
52
|
-
:query="query"
|
|
53
|
-
:onEdge="onEdge"
|
|
54
|
-
:onAction="onAction"
|
|
55
|
-
/>
|
|
56
|
-
</template>
|
|
57
|
-
</metro-widget>
|
|
58
|
-
</template>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-08 15:05:00
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-08 17:46:39
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { ref, shallowRef } from "vue";
|
|
10
|
-
|
|
11
|
-
const props = defineProps({
|
|
12
|
-
data: Object,
|
|
13
|
-
query: Object,
|
|
14
|
-
onEdge: Function,
|
|
15
|
-
onAction: Object,
|
|
16
|
-
});
|
|
17
|
-
const focused = ref(false);
|
|
18
|
-
const onFocus = () => {
|
|
19
|
-
focused.value = true;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const onBlur = () => {
|
|
23
|
-
focused.value = false;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const onClick = () => {};
|
|
27
|
-
|
|
28
|
-
props.onAction.register("onFocus", onFocus);
|
|
29
|
-
props.onAction.register("onBlur", onBlur);
|
|
30
|
-
props.onAction.register("onClick", onClick);
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<div
|
|
35
|
-
:style="{
|
|
36
|
-
width: props.data.width,
|
|
37
|
-
height: props.data.height,
|
|
38
|
-
fontSize: 30,
|
|
39
|
-
backgroundColor: focused ? '#DD8800' : '#BBBBAA',
|
|
40
|
-
}"
|
|
41
|
-
>
|
|
42
|
-
{{ data.content }}
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import Scroll from "./Scroll.vue";
|
|
3
|
-
import { ref, shallowRef, onMounted } from "vue";
|
|
4
|
-
import { useFocusHub } from "jsview";
|
|
5
|
-
|
|
6
|
-
const props = defineProps({
|
|
7
|
-
step: Number,
|
|
8
|
-
style: Object,
|
|
9
|
-
scrollStyle: Object,
|
|
10
|
-
scrollBlockStyle: Object,
|
|
11
|
-
imageSrc: String,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const focusHub = useFocusHub();
|
|
15
|
-
const element = shallowRef(null);
|
|
16
|
-
const scrollY = ref(0);
|
|
17
|
-
const textY = ref(0);
|
|
18
|
-
const onAction = {
|
|
19
|
-
onKeyDown: (ev) => {
|
|
20
|
-
const valid =
|
|
21
|
-
element.value &&
|
|
22
|
-
element.value.clientHeight &&
|
|
23
|
-
element.value.clientHeight > props.style.height;
|
|
24
|
-
// let keyUsed = true;
|
|
25
|
-
if (valid) {
|
|
26
|
-
let text_y;
|
|
27
|
-
switch (ev.keyCode) {
|
|
28
|
-
case 38:
|
|
29
|
-
if (textY.value !== 0) {
|
|
30
|
-
text_y =
|
|
31
|
-
textY.value + props.step >= 0 ? 0 : textY.value + props.step;
|
|
32
|
-
(textY.value = text_y),
|
|
33
|
-
(scrollY.value =
|
|
34
|
-
(-text_y / (element.value.clientHeight - props.style.height)) *
|
|
35
|
-
(props.scrollStyle.height - props.scrollBlockStyle.height));
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
case 40:
|
|
39
|
-
if (textY.value !== props.style.height - element.value.clientHeight) {
|
|
40
|
-
text_y =
|
|
41
|
-
textY.value - props.step <=
|
|
42
|
-
props.style.height - element.value.clientHeight
|
|
43
|
-
? props.style.height - element.value.clientHeight
|
|
44
|
-
: textY.value - props.step;
|
|
45
|
-
(textY.value = text_y),
|
|
46
|
-
(scrollY.value =
|
|
47
|
-
(-text_y / (element.value.clientHeight - props.style.height)) *
|
|
48
|
-
(props.scrollStyle.height - props.scrollBlockStyle.height));
|
|
49
|
-
} else {
|
|
50
|
-
focusHub.setFocus("button");
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
onFocus: () => {
|
|
57
|
-
console.log("LongImageScroll getFocus");
|
|
58
|
-
},
|
|
59
|
-
onBlur: () => {
|
|
60
|
-
console.log("LongImageScroll loseFocus");
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const onLoad = () => {
|
|
65
|
-
// 图片加载完成的回调
|
|
66
|
-
console.log("Image loaded!");
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
onMounted(() => {
|
|
70
|
-
focusHub.setFocus("longImageScroll");
|
|
71
|
-
});
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<template>
|
|
76
|
-
<jsv-focus-block name="longImageScroll" :onAction="onAction">
|
|
77
|
-
<div :style="{ overflow: 'hidden', ...style }">
|
|
78
|
-
<img
|
|
79
|
-
alt=""
|
|
80
|
-
ref="element"
|
|
81
|
-
:src="imageSrc"
|
|
82
|
-
:style="{ top: textY, width: style.width }"
|
|
83
|
-
:onLoad="onLoad"
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
<Scroll
|
|
87
|
-
:top="scrollY"
|
|
88
|
-
:scrollStyle="scrollStyle"
|
|
89
|
-
:scrollBlockStyle="scrollBlockStyle"
|
|
90
|
-
/>
|
|
91
|
-
</jsv-focus-block>
|
|
92
|
-
</template>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
defineProps({
|
|
3
|
-
scrollStyle: Object,
|
|
4
|
-
top: Number,
|
|
5
|
-
scrollBlockStyle: Object,
|
|
6
|
-
});
|
|
7
|
-
</script>
|
|
8
|
-
<template>
|
|
9
|
-
<div :style="{ ...scrollStyle }">
|
|
10
|
-
<div :style="{ top: top }">
|
|
11
|
-
<div :style="{ ...scrollBlockStyle }"></div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
Binary file
|
package/samples/LongText/App.vue
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* 【界面概述】
|
|
3
|
-
* 协议书的示例
|
|
4
|
-
*
|
|
5
|
-
* 【控件介绍】
|
|
6
|
-
* SimpleWidget:见simpleMetrowidget
|
|
7
|
-
*
|
|
8
|
-
* 【技巧说明】
|
|
9
|
-
* Q: 如何长文字div的高度自适应?
|
|
10
|
-
* A: 描画长文字的div的高度不设置即可
|
|
11
|
-
* 并通过element.clientHeight获取渲染后的自动高度,以决定滚动轴的总高度
|
|
12
|
-
*
|
|
13
|
-
* Q: 长段文字如何换行?
|
|
14
|
-
* A: 若文字内容中需要折行,则需要把要显示内容放入字符串中,并加入'\n'来达到换行效果,例如:
|
|
15
|
-
* <div>{"第一行
|
|
16
|
-
* 第二行"}</div>
|
|
17
|
-
* =======需要改成=======
|
|
18
|
-
* <div>{"第一行\n\
|
|
19
|
-
* 第二行"}</div>
|
|
20
|
-
*
|
|
21
|
-
* Q: 文字首行缩进如何做?
|
|
22
|
-
* A: 目前系统只支持通过空格进行首行缩进,行首加入期望的空格数量即可达到缩进,因为盒子字体库和PC不尽相同,
|
|
23
|
-
* 所以务必在盒子上实际测试缩进效果。
|
|
24
|
-
-->
|
|
25
|
-
|
|
26
|
-
<script setup>
|
|
27
|
-
import LongTextScroll from "./LongTextScroll.vue";
|
|
28
|
-
import Button from "./Button.vue";
|
|
29
|
-
import { jJsvRuntimeBridge } from "jsview";
|
|
30
|
-
import { onMounted, ref, shallowRef } from "vue";
|
|
31
|
-
import { useRouter } from "vue-router";
|
|
32
|
-
|
|
33
|
-
const router = useRouter();
|
|
34
|
-
|
|
35
|
-
const onKeyDown = (ev) => {
|
|
36
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
37
|
-
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
onMounted(() => {
|
|
43
|
-
jJsvRuntimeBridge.notifyPageLoaded();
|
|
44
|
-
});
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<template>
|
|
48
|
-
<jsv-focus-block
|
|
49
|
-
autoFocus
|
|
50
|
-
:onAction="{
|
|
51
|
-
onKeyDown: onKeyDown,
|
|
52
|
-
}"
|
|
53
|
-
>
|
|
54
|
-
<div>
|
|
55
|
-
<div
|
|
56
|
-
:style="{
|
|
57
|
-
textAlign: 'center',
|
|
58
|
-
fontSize: '30px',
|
|
59
|
-
lineHeight: '50px',
|
|
60
|
-
color: '#ffffff',
|
|
61
|
-
left: 140,
|
|
62
|
-
top: 20,
|
|
63
|
-
width: 1000,
|
|
64
|
-
height: 50,
|
|
65
|
-
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
66
|
-
}"
|
|
67
|
-
>
|
|
68
|
-
可展示篇幅超过一屏的文字
|
|
69
|
-
</div>
|
|
70
|
-
<div :style="{ left: 140, top: 100 }">
|
|
71
|
-
<LongTextScroll
|
|
72
|
-
:style="{ width: 1000, height: 500, backgroundColor: '#EEEEEE' }"
|
|
73
|
-
:textStyle="{ color: '#000000', fontSize: 20 }"
|
|
74
|
-
:scrollBlockStyle="{
|
|
75
|
-
width: 10,
|
|
76
|
-
height: 30,
|
|
77
|
-
backgroundColor: '#555555',
|
|
78
|
-
}"
|
|
79
|
-
:scrollStyle="{
|
|
80
|
-
left: 1005,
|
|
81
|
-
width: 10,
|
|
82
|
-
height: 500,
|
|
83
|
-
backgroundColor: '#DDDDDD',
|
|
84
|
-
}"
|
|
85
|
-
:step="20"
|
|
86
|
-
>
|
|
87
|
-
</LongTextScroll>
|
|
88
|
-
<div :style="{ left: 400, top: 550 }">
|
|
89
|
-
<Button />
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
</jsv-focus-block>
|
|
94
|
-
</template>
|
|
95
|
-
|
|
96
|
-
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, shallowRef } from "vue";
|
|
3
|
-
import { HORIZONTAL, MetroWidget, EdgeDirection, useFocusHub } from "jsview";
|
|
4
|
-
import ButtonItem from "./ButtonItem.vue";
|
|
5
|
-
|
|
6
|
-
const focusHub = useFocusHub();
|
|
7
|
-
const data = [
|
|
8
|
-
{
|
|
9
|
-
width: 100,
|
|
10
|
-
height: 50,
|
|
11
|
-
marginRight: 100,
|
|
12
|
-
content: "同意",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
width: 100,
|
|
16
|
-
height: 50,
|
|
17
|
-
content: "取消",
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
const measures = (item) => {
|
|
22
|
-
return item;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const onEdge = (edgeInfo) => {
|
|
26
|
-
if (edgeInfo.direction == EdgeDirection.top) {
|
|
27
|
-
focusHub.setFocus("longTextScroll");
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<template>
|
|
33
|
-
<metro-widget
|
|
34
|
-
name="button"
|
|
35
|
-
:width="500"
|
|
36
|
-
:height="50"
|
|
37
|
-
:data="data"
|
|
38
|
-
:direction="HORIZONTAL"
|
|
39
|
-
:measures="measures"
|
|
40
|
-
:onEdge="onEdge"
|
|
41
|
-
>
|
|
42
|
-
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
43
|
-
<button-item
|
|
44
|
-
:data="data"
|
|
45
|
-
:query="query"
|
|
46
|
-
:onEdge="onEdge"
|
|
47
|
-
:onAction="onAction"
|
|
48
|
-
/>
|
|
49
|
-
</template>
|
|
50
|
-
</metro-widget>
|
|
51
|
-
</template>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-08 15:05:00
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-08 17:45:44
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { ref, shallowRef } from "vue";
|
|
10
|
-
|
|
11
|
-
const props = defineProps({
|
|
12
|
-
data: Object,
|
|
13
|
-
query: Object,
|
|
14
|
-
onEdge: Function,
|
|
15
|
-
onAction: Object,
|
|
16
|
-
});
|
|
17
|
-
const focused = ref(false);
|
|
18
|
-
const onFocus = () => {
|
|
19
|
-
focused.value = true;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const onBlur = () => {
|
|
23
|
-
focused.value = false;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const onClick = () => {};
|
|
27
|
-
|
|
28
|
-
props.onAction.register("onFocus", onFocus);
|
|
29
|
-
props.onAction.register("onBlur", onBlur);
|
|
30
|
-
props.onAction.register("onClick", onClick);
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<div
|
|
35
|
-
:style="{
|
|
36
|
-
width: props.data.width,
|
|
37
|
-
height: props.data.height,
|
|
38
|
-
fontSize: 30,
|
|
39
|
-
backgroundColor: focused ? '#DD8800' : '#BBBBAA',
|
|
40
|
-
}"
|
|
41
|
-
>
|
|
42
|
-
{{ data.content }}
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|