@shijiu/jsview-vue-samples 2.0.1021 → 2.0.1073
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/Basic/components/div/DivBackground.vue +1 -1
- package/Basic/components/div/DivCssVar.vue +34 -16
- package/CommonUtils/ResourceData.js +11 -0
- package/CommonUtils/getSearchQuery.js +44 -0
- package/CssPreprocessor/Less/App.vue +1 -1
- package/CssPreprocessor/Less/components/less-group1/LessComments.vue +2 -2
- package/CssPreprocessor/Less/components/less-group1/LessConditionals.vue +2 -2
- package/CssPreprocessor/Less/components/less-group1/LessVariables.vue +6 -6
- package/CssPreprocessor/Less/components/less-group2/LessIteration.vue +1 -1
- package/CssPreprocessor/Less/components/less-group2/LessMethods.vue +2 -2
- package/CssPreprocessor/Less/components/less-group3/LessExtends.vue +2 -2
- package/CssPreprocessor/Less/components/less-group3/LessNesting.vue +4 -4
- package/CssPreprocessor/Less/components/less-group4/LessKeyframes.vue +1 -1
- package/CssPreprocessor/Less/components/less-group4/LessMaps.vue +1 -1
- package/CssPreprocessor/Less/components/less-group4/LessMixins.vue +1 -1
- package/CssPreprocessor/Less/components/less-group5/LessImporting.vue +7 -3
- package/CssPreprocessor/Less/components/less-group5/TextSettings.less +8 -1
- package/CssPreprocessor/Scss/App.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group1/ScssComments.vue +11 -10
- package/CssPreprocessor/Scss/components/scss-group1/ScssConditionals.vue +8 -6
- package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +2 -2
- package/CssPreprocessor/Scss/components/scss-group1/ScssVariables.vue +6 -6
- package/CssPreprocessor/Scss/components/scss-group2/ScssIteration.vue +2 -2
- package/CssPreprocessor/Scss/components/scss-group2/ScssMethods.vue +9 -9
- package/CssPreprocessor/Scss/components/scss-group3/ScssExtends.vue +2 -2
- package/CssPreprocessor/Scss/components/scss-group3/ScssNesting.vue +3 -3
- package/CssPreprocessor/Scss/components/scss-group4/ScssKeyframes.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group4/ScssMixins.vue +1 -1
- package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +7 -3
- package/CssPreprocessor/Scss/components/scss-group5/TextSettings.scss +8 -1
- package/CssPreprocessor/Stylus/App.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusComments.vue +2 -2
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusConditionals.vue +2 -2
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusVariables.vue +7 -7
- package/CssPreprocessor/Stylus/components/stylus-group2/StylusIteration.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group2/StylusMethods.vue +3 -3
- package/CssPreprocessor/Stylus/components/stylus-group3/StylusExtends.vue +2 -2
- package/CssPreprocessor/Stylus/components/stylus-group3/StylusNesting.vue +5 -5
- package/CssPreprocessor/Stylus/components/stylus-group4/StylusKeyframes.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group4/StylusMaps.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group4/StylusMixins.vue +1 -1
- package/CssPreprocessor/Stylus/components/stylus-group5/StylusImporting.vue +7 -3
- package/CssPreprocessor/Stylus/components/stylus-group5/TextSettings.styl +8 -1
- package/CssPreprocessor/utils/ContentBlock.vue +5 -3
- package/CssPreprocessor/utils/FontStyle.css +1 -1
- package/CssPreprocessor/utils/Panel.vue +1 -1
- package/CssPreprocessor/utils/TitleBar.vue +4 -2
- package/DemoHomepage/App.vue +22 -19
- package/DemoHomepage/router.js +9 -0
- package/FilterDemo/AnimatePic.vue +6 -1
- package/FocusMoveStyle/App.vue +37 -46
- package/FocusMoveStyle/Item.vue +7 -17
- package/FocusMoveStyle/assets/redCircle.png +0 -0
- package/GiftRain/App.vue +52 -27
- package/GiftRain/components/RedPacket.vue +17 -15
- package/JsvRadarChart/App.vue +99 -0
- package/JsvRadarChart/assets/Square.png +0 -0
- package/JsvRadarChart/assets/resultSquare.png +0 -0
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +78 -0
- package/MetroWidgetDemos/SkeletonDiagram/Item.vue +111 -0
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +237 -0
- package/MetroWidgetDemos/SkeletonDiagram/data.js +16 -0
- package/MetroWidgetDemos/itemSizeUpdate/App.vue +51 -0
- package/MetroWidgetDemos/itemSizeUpdate/backward/Backward.vue +107 -0
- package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +133 -0
- package/MetroWidgetDemos/itemSizeUpdate/center/Center.vue +106 -0
- package/MetroWidgetDemos/itemSizeUpdate/center/Item.vue +118 -0
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +105 -0
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +69 -0
- package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +89 -0
- package/MetroWidgetDemos/routeList.js +18 -5
- package/MetroWidgetDemos/slideSetting/App.vue +8 -8
- package/MockjsDemo/App.vue +54 -0
- package/MockjsDemo/KeyEventCatcher.vue +19 -0
- package/MockjsDemo/mock/index.js +12 -0
- package/NinePatchDemo/App.vue +2 -2
- package/NinePatchDemo/Item.vue +15 -5
- package/Preload/Item.vue +27 -10
- package/SprayView/App.vue +71 -63
- package/SprayView/assets/goldencoin1.png +0 -0
- package/SprayView/assets/goldencoin2.png +0 -0
- package/SprayView/assets/redpacket1.png +0 -0
- package/SprayView/assets/redpacket2.png +0 -0
- package/SprayView/assets/star1.png +0 -0
- package/SprayView/assets/star2.png +0 -0
- package/SprayView/assets/star3.png +0 -0
- package/SprayView/assets/star4.png +0 -0
- package/Swiper/App.vue +1 -1
- package/TextureAnimation/App2.vue +4 -2
- package/TouchSample/Item.vue +0 -1
- package/package.json +2 -1
- /package/{FocusMoveStyle/assets/focus.png → assets/focus1.png} +0 -0
|
@@ -16,9 +16,13 @@ export default {
|
|
|
16
16
|
+ 'TextSettings.scss\n'
|
|
17
17
|
+ '\n'
|
|
18
18
|
+ '.scss-imported {\n'
|
|
19
|
-
+ ' color: #
|
|
20
|
-
+ ' font-size: 14
|
|
21
|
-
|
|
19
|
+
+ ' color: #126085;\n'
|
|
20
|
+
+ ' font-size: 14;'}}
|
|
21
|
+
<div class="scss-nesting">
|
|
22
|
+
{{' .scss-nesting {\n'
|
|
23
|
+
+ ' color: #5149a1;\n'
|
|
24
|
+
+ ' }' }}
|
|
25
|
+
</div>
|
|
22
26
|
</div>
|
|
23
27
|
</div>
|
|
24
28
|
</template>
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
+ '.stylus-comments {\n'
|
|
12
12
|
+ ' // stylus 单行注释\n'
|
|
13
13
|
+ ' /* stylus 多行注释 */\n'
|
|
14
|
-
+ ' color: #
|
|
14
|
+
+ ' color: #126085;\n'
|
|
15
15
|
+ '}'}}
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
.stylus-comments {
|
|
24
24
|
// stylus 单行注释
|
|
25
25
|
/* stylus 多行注释 */
|
|
26
|
-
color: #
|
|
26
|
+
color: #126085;
|
|
27
27
|
font-size: 14;
|
|
28
28
|
|
|
29
29
|
left: 10;
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
+ ' if $show-green {\n'
|
|
12
12
|
+ ' color #00FF00\n'
|
|
13
13
|
+ ' } else {\n'
|
|
14
|
-
+ ' color #
|
|
14
|
+
+ ' color #126085\n'
|
|
15
15
|
+ ' }\n'
|
|
16
16
|
+ '}'}}
|
|
17
17
|
</div>
|
|
@@ -24,7 +24,7 @@ $show-green = false
|
|
|
24
24
|
if $show-green {
|
|
25
25
|
color: #00FF00;
|
|
26
26
|
} else {
|
|
27
|
-
color: #
|
|
27
|
+
color: #126085;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
font-size: 14;
|
|
@@ -6,14 +6,14 @@ export default {
|
|
|
6
6
|
<template>
|
|
7
7
|
<div>
|
|
8
8
|
<div class="stylus-var-general">
|
|
9
|
-
{{'$my-color = #
|
|
9
|
+
{{'$my-color = #126085; // 一般变量\n'
|
|
10
10
|
+ '.stylus-var-general {\n'
|
|
11
11
|
+ ' color: $my-color;\n'
|
|
12
12
|
+ '}'}}
|
|
13
13
|
</div>
|
|
14
14
|
<div class="stylus-var-enclosing">
|
|
15
15
|
{{'.stylus-var-enclosing {\n'
|
|
16
|
-
+ ' $my-color = #
|
|
16
|
+
+ ' $my-color = #5a4ba4; // 局部变量\n'
|
|
17
17
|
+ ' color: $my-color;\n'
|
|
18
18
|
+ '}'}}
|
|
19
19
|
</div>
|
|
@@ -21,24 +21,24 @@ export default {
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<style scoped lang="stylus">
|
|
24
|
-
$my-color = #
|
|
24
|
+
$my-color = #126085; // 一般变量
|
|
25
25
|
.stylus-var-general {
|
|
26
26
|
color: $my-color;
|
|
27
27
|
|
|
28
|
-
font-size:
|
|
28
|
+
font-size: 12;
|
|
29
29
|
left: 10;
|
|
30
30
|
top: 0;
|
|
31
31
|
width: 220;
|
|
32
32
|
height: 140;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
$my-color = #
|
|
35
|
+
$my-color = #126085;
|
|
36
36
|
.stylus-var-enclosing {
|
|
37
37
|
// 只在 .stylus-enclosing 里有效,局部作用域
|
|
38
|
-
$my-color = #
|
|
38
|
+
$my-color = #5a4ba4; // 局部变量
|
|
39
39
|
color: $my-color;
|
|
40
40
|
|
|
41
|
-
font-size:
|
|
41
|
+
font-size: 12;
|
|
42
42
|
left: 10;
|
|
43
43
|
top: 68;
|
|
44
44
|
width: 220;
|
|
@@ -41,7 +41,7 @@ getsize(zoom) { // 一般调用
|
|
|
41
41
|
.stylus-method-general {
|
|
42
42
|
font-size: getsize(7);
|
|
43
43
|
|
|
44
|
-
color: #
|
|
44
|
+
color: #126085
|
|
45
45
|
left: 10;
|
|
46
46
|
top: 10;
|
|
47
47
|
width: 240;
|
|
@@ -55,7 +55,7 @@ getsize(zoom) { // 具名参数
|
|
|
55
55
|
.stylus-method-named {
|
|
56
56
|
font-size: getsize(zoom: 7);
|
|
57
57
|
|
|
58
|
-
color: #
|
|
58
|
+
color: #126085;
|
|
59
59
|
left: 10;
|
|
60
60
|
top: 140;
|
|
61
61
|
width: 240;
|
|
@@ -69,7 +69,7 @@ getsize(args...) { // 不定参数
|
|
|
69
69
|
.stylus-method-varargs {
|
|
70
70
|
font-size: getsize(7);
|
|
71
71
|
|
|
72
|
-
color: #
|
|
72
|
+
color: #126085;
|
|
73
73
|
left: 10;
|
|
74
74
|
top: 270;
|
|
75
75
|
width: 240;
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
<div>
|
|
8
8
|
<div class="stylus-extend">
|
|
9
9
|
{{'.stylus-basic {\n'
|
|
10
|
-
+ ' color: #
|
|
10
|
+
+ ' color: #126085;\n'
|
|
11
11
|
+ '}\n'
|
|
12
12
|
+ '.stylus-extend {\n'
|
|
13
13
|
+ ' @extend .stylus-basic;\n'
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
|
|
20
20
|
<style scoped lang='stylus'>
|
|
21
21
|
.stylus-basic {
|
|
22
|
-
color: #
|
|
22
|
+
color: #126085;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.stylus-extend {
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
<div class="stylus-root">
|
|
8
8
|
<div class="stylus-rule-nesting">
|
|
9
9
|
{{'.stylus-root {\n'
|
|
10
|
-
+ ' color: #
|
|
10
|
+
+ ' color: #126085;\n'
|
|
11
11
|
+ ' .stylus-rule-nesting { // 规则嵌套\n'
|
|
12
12
|
+ ' font-size: 14;\n'
|
|
13
13
|
+ ' }\n'
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
</div>
|
|
20
20
|
<div class="stylus-root-parent-selector">
|
|
21
21
|
{{'.stylus-root {\n'
|
|
22
|
-
+ ' color: #
|
|
22
|
+
+ ' color: #126085;\n'
|
|
23
23
|
+ ' &-parent-selector { // 父选择器\n'
|
|
24
24
|
+ ' font-size: 14;\n'
|
|
25
25
|
+ ' }\n'
|
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
|
|
31
31
|
<style scoped lang='stylus'>
|
|
32
32
|
.stylus-root {
|
|
33
|
-
color: #
|
|
33
|
+
color: #126085;
|
|
34
34
|
|
|
35
35
|
.stylus-rule-nesting { // 规则嵌套
|
|
36
36
|
font-size: 14;
|
|
@@ -42,8 +42,8 @@ export default {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.stylus-prop-nesting { // 属性嵌套(不支持)
|
|
45
|
-
color: #
|
|
46
|
-
font-size: 14;
|
|
45
|
+
color: #5a4ba4;
|
|
46
|
+
font-size: 14; // 不支持 font:{size:14} 写法
|
|
47
47
|
|
|
48
48
|
left: 10;
|
|
49
49
|
top: 120;
|
|
@@ -16,9 +16,13 @@ export default {
|
|
|
16
16
|
+ 'TextSettings.styl\n'
|
|
17
17
|
+ '\n'
|
|
18
18
|
+ '.stylus-imported {\n'
|
|
19
|
-
+ ' color: #
|
|
20
|
-
+ ' font-size: 14;\n'
|
|
21
|
-
|
|
19
|
+
+ ' color: #126085;\n'
|
|
20
|
+
+ ' font-size: 14;\n'}}
|
|
21
|
+
<div class="stylus-nesting">
|
|
22
|
+
{{' .stylus-nesting {\n'
|
|
23
|
+
+ ' color: #5149a1;\n'
|
|
24
|
+
+ ' }' }}
|
|
25
|
+
</div>
|
|
22
26
|
</div>
|
|
23
27
|
</div>
|
|
24
28
|
</template>
|
|
@@ -16,7 +16,8 @@ export default {
|
|
|
16
16
|
titleStyle: {
|
|
17
17
|
lineHeight: 18,
|
|
18
18
|
width: this.style.width, height: 18,
|
|
19
|
-
backgroundColor: 'rgba(
|
|
19
|
+
backgroundColor: 'rgba(142,175,153,1)',
|
|
20
|
+
textAlign:'center'
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -32,12 +33,13 @@ export default {
|
|
|
32
33
|
</div>
|
|
33
34
|
<div class="content-font" :style="{ top: titleStyle.lineHeight,
|
|
34
35
|
width: style.width, height: style.height - 18,
|
|
35
|
-
backgroundColor: 'rgba(0,0,
|
|
36
|
+
backgroundColor: 'rgba(0,0,0,'+blockOpacity+')' }">
|
|
36
37
|
<slot/>
|
|
37
38
|
</div>
|
|
38
39
|
</div>
|
|
39
40
|
</template>
|
|
40
41
|
|
|
41
|
-
<style
|
|
42
|
+
<style>
|
|
43
|
+
/* css文件要单独放到没有scoped设置的style标签中,规避css属性redefine的warning */
|
|
42
44
|
@import "./FontStyle.css";
|
|
43
45
|
</style>
|
|
@@ -18,12 +18,14 @@ export default {
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<style scoped>
|
|
21
|
-
@import "./FontStyle.css";
|
|
22
|
-
|
|
23
21
|
.title-range {
|
|
24
22
|
left: 0;
|
|
25
23
|
top: 0;
|
|
26
24
|
width: v-bind('style.width');
|
|
27
25
|
height: 20;
|
|
28
26
|
}
|
|
27
|
+
</style>
|
|
28
|
+
<style>
|
|
29
|
+
/* css文件要单独放到没有scoped设置的style标签中,规避css属性redefine的warning */
|
|
30
|
+
@import "./FontStyle.css";
|
|
29
31
|
</style>
|
package/DemoHomepage/App.vue
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
import { shallowRef, onMounted } from "vue";
|
|
10
10
|
import { JsvPreload, buildPreloadInfo, jJsvRuntimeBridge, JsvFocusBlock } from "jsview";
|
|
11
11
|
import { useRouter } from "vue-router";
|
|
12
|
-
|
|
12
|
+
import { setDataUrl, getDataUrl } from "../CommonUtils/ResourceData.js"
|
|
13
|
+
import { getSearchQuery } from "../CommonUtils/getSearchQuery.js"
|
|
13
14
|
let router = useRouter();
|
|
14
|
-
|
|
15
|
+
let DemoResourceBase=shallowRef("")
|
|
15
16
|
let backgroundImageUrl = shallowRef(null);
|
|
16
17
|
|
|
17
18
|
let preloadInfo = shallowRef([]);
|
|
@@ -21,9 +22,9 @@ let _onPreloadDone = () => {
|
|
|
21
22
|
jJsvRuntimeBridge.notifyPageLoaded();
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const _OnKeyDown = (ev)=>{
|
|
25
|
+
const _OnKeyDown = (ev) => {
|
|
25
26
|
// 结果默认传下来的返回键
|
|
26
|
-
if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
27
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
27
28
|
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
28
29
|
return true;
|
|
29
30
|
}
|
|
@@ -31,11 +32,19 @@ const _OnKeyDown = (ev)=>{
|
|
|
31
32
|
return false;
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
//解析url
|
|
36
|
+
let query = getSearchQuery(window.location.href, undefined, 0)
|
|
37
|
+
if (query.DemoResourceBase) {
|
|
38
|
+
setDataUrl(query.DemoResourceBase)
|
|
39
|
+
//无网络环境下使用
|
|
40
|
+
DemoResourceBase.value = getDataUrl()
|
|
41
|
+
}
|
|
34
42
|
onMounted(() => {
|
|
35
43
|
console.log("simulate async get background url");
|
|
36
44
|
setTimeout(() => {
|
|
37
45
|
console.log("simulate background url got");
|
|
38
|
-
backgroundImageUrl.value =
|
|
46
|
+
backgroundImageUrl.value = DemoResourceBase.value ? `${DemoResourceBase.value}/BackgroundLongmao.jpg`
|
|
47
|
+
:
|
|
39
48
|
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg";
|
|
40
49
|
preloadInfo.value = [buildPreloadInfo(backgroundImageUrl.value)];
|
|
41
50
|
}, 0);
|
|
@@ -51,21 +60,15 @@ export default {
|
|
|
51
60
|
|
|
52
61
|
<template>
|
|
53
62
|
<div>
|
|
54
|
-
<jsv-preload
|
|
55
|
-
:key="backgroundImageUrl"
|
|
56
|
-
:preloadList="preloadInfo"
|
|
57
|
-
:onPreloadDone="_onPreloadDone"
|
|
58
|
-
/>
|
|
63
|
+
<jsv-preload :key="backgroundImageUrl" :preloadList="preloadInfo" :onPreloadDone="_onPreloadDone" />
|
|
59
64
|
<div :style="{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<jsv-focus-block
|
|
65
|
-
:
|
|
66
|
-
|
|
67
|
-
}"
|
|
68
|
-
>
|
|
65
|
+
width: 1280,
|
|
66
|
+
height: 720,
|
|
67
|
+
backgroundImage: backgroundImageUrl,
|
|
68
|
+
}" />
|
|
69
|
+
<jsv-focus-block :onAction="{
|
|
70
|
+
onKeyDown: _OnKeyDown
|
|
71
|
+
}">
|
|
69
72
|
<router-view v-slot="{ Component, route }">
|
|
70
73
|
<keep-alive>
|
|
71
74
|
<component v-if="route.meta.keepAlive" :is="Component" />
|
package/DemoHomepage/router.js
CHANGED
|
@@ -187,10 +187,19 @@ let routeList = [
|
|
|
187
187
|
path: '/Operations/FocusMoveStyle',
|
|
188
188
|
component: () => import('jsview-vue-samples/FocusMoveStyle/App.vue'),
|
|
189
189
|
},
|
|
190
|
+
{
|
|
191
|
+
name: 'Mockjs',
|
|
192
|
+
path: '/feature/MockjsDemo',
|
|
193
|
+
component: () => import('jsview-vue-samples/MockjsDemo/App.vue'),
|
|
194
|
+
},
|
|
190
195
|
{
|
|
191
196
|
name:'红包雨',
|
|
192
197
|
path:'/Game/GiftRain',
|
|
193
198
|
component:()=>import('jsview-vue-samples/GiftRain/App.vue'),
|
|
199
|
+
},{
|
|
200
|
+
name:'雷达图',
|
|
201
|
+
path:'/Game/RadarChart',
|
|
202
|
+
component:()=>import('jsview-vue-samples/JsvRadarChart/App.vue')
|
|
194
203
|
}
|
|
195
204
|
];
|
|
196
205
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
2
|
+
import { getDataUrl } from "../CommonUtils/ResourceData";
|
|
3
|
+
//无网络环境下使用
|
|
4
|
+
const DemoResourceBase = getDataUrl()
|
|
5
|
+
const item_url = DemoResourceBase ?
|
|
6
|
+
`${DemoResourceBase}/27bda620942566673ab449a3ef765321.png`
|
|
7
|
+
:
|
|
3
8
|
"http://oss.image.51vtv.cn/homepage/20210209/27bda620942566673ab449a3ef765321.png";
|
|
4
9
|
</script>
|
|
5
10
|
|
package/FocusMoveStyle/App.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { MetroWidget, HORIZONTAL, JsvNinePatch, useFocusHub } from "jsview";
|
|
2
|
+
import { MetroWidget, HORIZONTAL, JsvNinePatch, useFocusHub, getTextWidth } from "jsview";
|
|
3
3
|
import Item from "./Item.vue";
|
|
4
|
-
import
|
|
4
|
+
import redCircle from "./assets/redCircle.png"
|
|
5
5
|
import { reactive, provide, onMounted } from "vue";
|
|
6
6
|
const focusHub = useFocusHub();
|
|
7
7
|
const randomColor = () => {
|
|
@@ -55,14 +55,18 @@ const focusFrameController = {
|
|
|
55
55
|
};
|
|
56
56
|
provide("focusFrameController", focusFrameController);
|
|
57
57
|
|
|
58
|
+
const contentData = ['推荐', '电视剧', '电影', '云影院', '综艺', '儿童', '动漫', '游戏', '纪录片', '体育', '知识', '导航']
|
|
59
|
+
const SizeObj = {
|
|
60
|
+
fontSize: 40
|
|
61
|
+
}
|
|
58
62
|
const provideData = () => {
|
|
59
63
|
const data = [];
|
|
60
|
-
for (let i = 0; i <
|
|
64
|
+
for (let i = 0; i < 12; ++i) {
|
|
61
65
|
data.push({
|
|
62
|
-
width:
|
|
63
|
-
height:
|
|
66
|
+
width: getTextWidth(contentData[i], SizeObj) + 60,
|
|
67
|
+
height: 65,
|
|
64
68
|
color: randomColor(),
|
|
65
|
-
content: i,
|
|
69
|
+
content: contentData[i],
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
return data;
|
|
@@ -84,52 +88,39 @@ onMounted(() => {
|
|
|
84
88
|
|
|
85
89
|
<template>
|
|
86
90
|
<div :style="{ width: 1280, height: 720, backgroundColor: '#007788' }">
|
|
87
|
-
<div
|
|
88
|
-
:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}"
|
|
99
|
-
>
|
|
91
|
+
<div :style="{
|
|
92
|
+
textAlign: 'center',
|
|
93
|
+
fontSize: 30,
|
|
94
|
+
lineHeight: 50,
|
|
95
|
+
color: '#ffffff',
|
|
96
|
+
left: 140,
|
|
97
|
+
top: 20,
|
|
98
|
+
width: 1000,
|
|
99
|
+
height: 50,
|
|
100
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
101
|
+
}">
|
|
100
102
|
爬行样式的焦点示例
|
|
101
103
|
</div>
|
|
102
|
-
<metro-widget
|
|
103
|
-
|
|
104
|
-
:top="100"
|
|
105
|
-
:left="40"
|
|
106
|
-
:width="1200"
|
|
107
|
-
:height="110"
|
|
108
|
-
:direction="HORIZONTAL"
|
|
109
|
-
:provideData="provideData"
|
|
110
|
-
:measures="measures"
|
|
111
|
-
:padding="{ left: 20, right: 20, top: 20, height: 20 }"
|
|
112
|
-
>
|
|
104
|
+
<metro-widget name="myWidget" :top="100" :left="40" :width="1200" :height="110" :direction="HORIZONTAL"
|
|
105
|
+
:provideData="provideData" :measures="measures" :padding="{ left: 20, right: 20, top: 20, height: 20 }">
|
|
113
106
|
<template #renderItem="{ data, onAction, query }">
|
|
114
107
|
<item :data="data" :onAction="onAction" :query="query" />
|
|
115
108
|
</template>
|
|
116
109
|
<template #background>
|
|
117
|
-
<jsv-nine-patch
|
|
118
|
-
:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
:waitForInit="true"
|
|
132
|
-
></jsv-nine-patch>
|
|
110
|
+
<jsv-nine-patch :style="{
|
|
111
|
+
width: focusSize.width,
|
|
112
|
+
height: focusSize.height,
|
|
113
|
+
top: focusSize.top,
|
|
114
|
+
left: focusSize.left,
|
|
115
|
+
}"
|
|
116
|
+
:onTransitionEnd="focusSize.onTransitionEnd"
|
|
117
|
+
:imageUrl="redCircle"
|
|
118
|
+
:imageWidth="35"
|
|
119
|
+
:centerWidth="0"
|
|
120
|
+
:borderOutset="0"
|
|
121
|
+
:imageDspWidth="focusSize.height/17*2"
|
|
122
|
+
:animTime="0.2"
|
|
123
|
+
:waitForInit="true"></jsv-nine-patch>
|
|
133
124
|
</template>
|
|
134
125
|
</metro-widget>
|
|
135
126
|
</div>
|
package/FocusMoveStyle/Item.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, inject
|
|
2
|
+
import { ref, inject } from "vue";
|
|
3
3
|
|
|
4
4
|
const focusFrameController = inject("focusFrameController");
|
|
5
5
|
|
|
@@ -25,6 +25,7 @@ const onFocus = () => {
|
|
|
25
25
|
if (focusFrameController) {
|
|
26
26
|
const rect = props.query.templatePosition(props.query.index);
|
|
27
27
|
focusFrameController.onFocusChange(rect);
|
|
28
|
+
focused.value=true
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
|
|
@@ -46,12 +47,13 @@ props.onAction.register("onClick", onClicked);
|
|
|
46
47
|
<div
|
|
47
48
|
ref="divRef"
|
|
48
49
|
:style="{
|
|
49
|
-
fontSize:
|
|
50
|
+
fontSize: 40,
|
|
50
51
|
width: data.width,
|
|
51
52
|
height: data.height,
|
|
52
53
|
color: '#FFFFFF',
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
lineHeight: data.height,
|
|
56
|
+
transform:focused?'scale3d(1.1,1.1,1)':'scale3d(1,1,1)'
|
|
55
57
|
}"
|
|
56
58
|
>
|
|
57
59
|
{{ data.content }}
|
|
@@ -59,16 +61,4 @@ props.onAction.register("onClick", onClicked);
|
|
|
59
61
|
</div>
|
|
60
62
|
</template>
|
|
61
63
|
|
|
62
|
-
<style scoped>
|
|
63
|
-
.focus {
|
|
64
|
-
transform: scale3d(1.2, 1.2, 1);
|
|
65
|
-
transition: transform 0.25s linear;
|
|
66
|
-
font-size: 30;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.blur {
|
|
70
|
-
transform: scale3d(1, 1, 1);
|
|
71
|
-
transition: transform 0.25s linear;
|
|
72
|
-
font-size: 30;
|
|
73
|
-
}
|
|
74
|
-
</style>
|
|
64
|
+
<style scoped></style>
|
|
Binary file
|