@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.
Files changed (93) hide show
  1. package/Basic/components/div/DivBackground.vue +1 -1
  2. package/Basic/components/div/DivCssVar.vue +34 -16
  3. package/CommonUtils/ResourceData.js +11 -0
  4. package/CommonUtils/getSearchQuery.js +44 -0
  5. package/CssPreprocessor/Less/App.vue +1 -1
  6. package/CssPreprocessor/Less/components/less-group1/LessComments.vue +2 -2
  7. package/CssPreprocessor/Less/components/less-group1/LessConditionals.vue +2 -2
  8. package/CssPreprocessor/Less/components/less-group1/LessVariables.vue +6 -6
  9. package/CssPreprocessor/Less/components/less-group2/LessIteration.vue +1 -1
  10. package/CssPreprocessor/Less/components/less-group2/LessMethods.vue +2 -2
  11. package/CssPreprocessor/Less/components/less-group3/LessExtends.vue +2 -2
  12. package/CssPreprocessor/Less/components/less-group3/LessNesting.vue +4 -4
  13. package/CssPreprocessor/Less/components/less-group4/LessKeyframes.vue +1 -1
  14. package/CssPreprocessor/Less/components/less-group4/LessMaps.vue +1 -1
  15. package/CssPreprocessor/Less/components/less-group4/LessMixins.vue +1 -1
  16. package/CssPreprocessor/Less/components/less-group5/LessImporting.vue +7 -3
  17. package/CssPreprocessor/Less/components/less-group5/TextSettings.less +8 -1
  18. package/CssPreprocessor/Scss/App.vue +1 -1
  19. package/CssPreprocessor/Scss/components/scss-group1/ScssComments.vue +11 -10
  20. package/CssPreprocessor/Scss/components/scss-group1/ScssConditionals.vue +8 -6
  21. package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +2 -2
  22. package/CssPreprocessor/Scss/components/scss-group1/ScssVariables.vue +6 -6
  23. package/CssPreprocessor/Scss/components/scss-group2/ScssIteration.vue +2 -2
  24. package/CssPreprocessor/Scss/components/scss-group2/ScssMethods.vue +9 -9
  25. package/CssPreprocessor/Scss/components/scss-group3/ScssExtends.vue +2 -2
  26. package/CssPreprocessor/Scss/components/scss-group3/ScssNesting.vue +3 -3
  27. package/CssPreprocessor/Scss/components/scss-group4/ScssKeyframes.vue +1 -1
  28. package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +1 -1
  29. package/CssPreprocessor/Scss/components/scss-group4/ScssMixins.vue +1 -1
  30. package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +7 -3
  31. package/CssPreprocessor/Scss/components/scss-group5/TextSettings.scss +8 -1
  32. package/CssPreprocessor/Stylus/App.vue +1 -1
  33. package/CssPreprocessor/Stylus/components/stylus-group1/StylusComments.vue +2 -2
  34. package/CssPreprocessor/Stylus/components/stylus-group1/StylusConditionals.vue +2 -2
  35. package/CssPreprocessor/Stylus/components/stylus-group1/StylusVariables.vue +7 -7
  36. package/CssPreprocessor/Stylus/components/stylus-group2/StylusIteration.vue +1 -1
  37. package/CssPreprocessor/Stylus/components/stylus-group2/StylusMethods.vue +3 -3
  38. package/CssPreprocessor/Stylus/components/stylus-group3/StylusExtends.vue +2 -2
  39. package/CssPreprocessor/Stylus/components/stylus-group3/StylusNesting.vue +5 -5
  40. package/CssPreprocessor/Stylus/components/stylus-group4/StylusKeyframes.vue +1 -1
  41. package/CssPreprocessor/Stylus/components/stylus-group4/StylusMaps.vue +1 -1
  42. package/CssPreprocessor/Stylus/components/stylus-group4/StylusMixins.vue +1 -1
  43. package/CssPreprocessor/Stylus/components/stylus-group5/StylusImporting.vue +7 -3
  44. package/CssPreprocessor/Stylus/components/stylus-group5/TextSettings.styl +8 -1
  45. package/CssPreprocessor/utils/ContentBlock.vue +5 -3
  46. package/CssPreprocessor/utils/FontStyle.css +1 -1
  47. package/CssPreprocessor/utils/Panel.vue +1 -1
  48. package/CssPreprocessor/utils/TitleBar.vue +4 -2
  49. package/DemoHomepage/App.vue +22 -19
  50. package/DemoHomepage/router.js +9 -0
  51. package/FilterDemo/AnimatePic.vue +6 -1
  52. package/FocusMoveStyle/App.vue +37 -46
  53. package/FocusMoveStyle/Item.vue +7 -17
  54. package/FocusMoveStyle/assets/redCircle.png +0 -0
  55. package/GiftRain/App.vue +52 -27
  56. package/GiftRain/components/RedPacket.vue +17 -15
  57. package/JsvRadarChart/App.vue +99 -0
  58. package/JsvRadarChart/assets/Square.png +0 -0
  59. package/JsvRadarChart/assets/resultSquare.png +0 -0
  60. package/MetroWidgetDemos/SkeletonDiagram/App.vue +78 -0
  61. package/MetroWidgetDemos/SkeletonDiagram/Item.vue +111 -0
  62. package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +237 -0
  63. package/MetroWidgetDemos/SkeletonDiagram/data.js +16 -0
  64. package/MetroWidgetDemos/itemSizeUpdate/App.vue +51 -0
  65. package/MetroWidgetDemos/itemSizeUpdate/backward/Backward.vue +107 -0
  66. package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +133 -0
  67. package/MetroWidgetDemos/itemSizeUpdate/center/Center.vue +106 -0
  68. package/MetroWidgetDemos/itemSizeUpdate/center/Item.vue +118 -0
  69. package/MetroWidgetDemos/ninePatchFocusPage/App.vue +105 -0
  70. package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +69 -0
  71. package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +89 -0
  72. package/MetroWidgetDemos/routeList.js +18 -5
  73. package/MetroWidgetDemos/slideSetting/App.vue +8 -8
  74. package/MockjsDemo/App.vue +54 -0
  75. package/MockjsDemo/KeyEventCatcher.vue +19 -0
  76. package/MockjsDemo/mock/index.js +12 -0
  77. package/NinePatchDemo/App.vue +2 -2
  78. package/NinePatchDemo/Item.vue +15 -5
  79. package/Preload/Item.vue +27 -10
  80. package/SprayView/App.vue +71 -63
  81. package/SprayView/assets/goldencoin1.png +0 -0
  82. package/SprayView/assets/goldencoin2.png +0 -0
  83. package/SprayView/assets/redpacket1.png +0 -0
  84. package/SprayView/assets/redpacket2.png +0 -0
  85. package/SprayView/assets/star1.png +0 -0
  86. package/SprayView/assets/star2.png +0 -0
  87. package/SprayView/assets/star3.png +0 -0
  88. package/SprayView/assets/star4.png +0 -0
  89. package/Swiper/App.vue +1 -1
  90. package/TextureAnimation/App2.vue +4 -2
  91. package/TouchSample/Item.vue +0 -1
  92. package/package.json +2 -1
  93. /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: #00FF00;\n'
20
- + ' font-size: 14;\n'
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>
@@ -1,4 +1,11 @@
1
1
  .scss-imported {
2
- color: #00FF00;
2
+ color: #126085;
3
3
  font-size: 14;
4
+ .scss-nesting{
5
+ color:#5149a1;
6
+ left: 0;
7
+ top: 230;
8
+ width: 230;
9
+ height: 280;
10
+ }
4
11
  }
@@ -27,6 +27,6 @@ export default {
27
27
  .root {
28
28
  top: 10; left: 10;
29
29
  width: 1250; height: 670;
30
- background-color: rgba(200, 200, 200, 1)
30
+ background-color: #d6e1ce
31
31
  }
32
32
  </style>
@@ -11,7 +11,7 @@ export default {
11
11
  + '.stylus-comments {\n'
12
12
  + ' // stylus 单行注释\n'
13
13
  + ' /* stylus 多行注释 */\n'
14
- + ' color: #00FF00;\n'
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: #00FF00;
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 #FF0000\n'
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: #FF0000;
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 = #00FF00; // 一般变量\n'
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 = #0000FF; // 局部变量\n'
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 = #00FF00; // 一般变量
24
+ $my-color = #126085; // 一般变量
25
25
  .stylus-var-general {
26
26
  color: $my-color;
27
27
 
28
- font-size: 14;
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 = #00FF00;
35
+ $my-color = #126085;
36
36
  .stylus-var-enclosing {
37
37
  // 只在 .stylus-enclosing 里有效,局部作用域
38
- $my-color = #FF0000; // 局部变量
38
+ $my-color = #5a4ba4; // 局部变量
39
39
  color: $my-color;
40
40
 
41
- font-size: 14;
41
+ font-size: 12;
42
42
  left: 10;
43
43
  top: 68;
44
44
  width: 220;
@@ -25,7 +25,7 @@ for num in 1..4
25
25
  .stylus-iteration {
26
26
  font-size: $size;
27
27
 
28
- color: #00FF00;
28
+ color: #126085;
29
29
  left: 10;
30
30
  top: 3;
31
31
  width: 230;
@@ -41,7 +41,7 @@ getsize(zoom) { // 一般调用
41
41
  .stylus-method-general {
42
42
  font-size: getsize(7);
43
43
 
44
- color: #00FF00;
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: #00FF00;
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: #00FF00;
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: #00FF00;\n'
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: #00FF00;
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: #00FF00;\n'
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: #00FF00;\n'
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: #00FF00;
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: #000000;
46
- font-size: 14;
45
+ color: #5a4ba4;
46
+ font-size: 14; // 不支持 font:{size:14} 写法
47
47
 
48
48
  left: 10;
49
49
  top: 120;
@@ -29,7 +29,7 @@ export default {
29
29
  }
30
30
 
31
31
  .stylus-keyframes {
32
- color: #00FF00;
32
+ color: #126085;
33
33
  font-size: 14;
34
34
 
35
35
  left: 10;
@@ -24,7 +24,7 @@ font-sizes = {
24
24
  .stylus-map {
25
25
  font-size: font-sizes[medium];
26
26
 
27
- color: #00FF00;
27
+ color: #126085;
28
28
  left: 10;
29
29
  top: 3;
30
30
  width: 230;
@@ -24,7 +24,7 @@ font(size) {
24
24
  .stylus-mixin {
25
25
  font(14);
26
26
 
27
- color: #00FF00;
27
+ color: #126085;
28
28
  left: 10;
29
29
  top: 0;
30
30
  width: 230;
@@ -16,9 +16,13 @@ export default {
16
16
  + 'TextSettings.styl\n'
17
17
  + '\n'
18
18
  + '.stylus-imported {\n'
19
- + ' color: #00FF00;\n'
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>
@@ -1,4 +1,11 @@
1
1
  .stylus-imported {
2
- color: #00FF00;
2
+ color: #126085;
3
3
  font-size: 14;
4
+ .stylus-nesting{
5
+ color:#5149a1;
6
+ left: 0;
7
+ top: 230;
8
+ width: 230;
9
+ height: 280;
10
+ }
4
11
  }
@@ -16,7 +16,8 @@ export default {
16
16
  titleStyle: {
17
17
  lineHeight: 18,
18
18
  width: this.style.width, height: 18,
19
- backgroundColor: 'rgba(0,0,255,0.7)',
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,255,'+blockOpacity+')' }">
36
+ backgroundColor: 'rgba(0,0,0,'+blockOpacity+')' }">
36
37
  <slot/>
37
38
  </div>
38
39
  </div>
39
40
  </template>
40
41
 
41
- <style scoped>
42
+ <style>
43
+ /* css文件要单独放到没有scoped设置的style标签中,规避css属性redefine的warning */
42
44
  @import "./FontStyle.css";
43
45
  </style>
@@ -1,6 +1,6 @@
1
1
 
2
2
  .title-font {
3
- color: #0000FF;
3
+ color:#877c4a;
4
4
  font-family: 黑体;
5
5
  font-size: 16;
6
6
  text-align: center;
@@ -17,7 +17,7 @@ export default {
17
17
  return this.style.width / this.panelData.title.length;
18
18
  },
19
19
  separatorColor() {
20
- return 'rgba(0,0,255,0.7)'
20
+ return 'rgba(142,175,153,1)'
21
21
  }
22
22
  },
23
23
  }
@@ -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>
@@ -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
- width: 1280,
61
- height: 720,
62
- backgroundImage: backgroundImageUrl,
63
- }"/>
64
- <jsv-focus-block
65
- :onAction = "{
66
- onKeyDown: _OnKeyDown
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" />
@@ -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
- const item_url =
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
 
@@ -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 borderImageUrl from "./assets/focus.png";
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 < 20; ++i) {
64
+ for (let i = 0; i < 12; ++i) {
61
65
  data.push({
62
- width: 100 + Math.round(Math.random() * 4) * 20,
63
- height: 50,
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
- :style="{
89
- textAlign: 'center',
90
- fontSize: 30,
91
- lineHeight: 50,
92
- color: '#ffffff',
93
- left: 140,
94
- top: 20,
95
- width: 1000,
96
- height: 50,
97
- backgroundColor: 'rgba(27,38,151,0.8)',
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
- name="myWidget"
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
- :style="{
119
- width: focusSize.width,
120
- height: focusSize.height,
121
- top: focusSize.top,
122
- left: focusSize.left,
123
- }"
124
- :onTransitionEnd="focusSize.onTransitionEnd"
125
- :imageUrl="borderImageUrl"
126
- :imageWidth="55"
127
- :centerWidth="1"
128
- :borderOutset="13"
129
- :imageDspWidth="30"
130
- :animTime="0.2"
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>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref, inject, nextTick } from "vue";
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: 30,
50
+ fontSize: 40,
50
51
  width: data.width,
51
52
  height: data.height,
52
53
  color: '#FFFFFF',
53
- backgroundColor: data.color,
54
- borderRadius: 5,
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>