@shijiu/jsview-vue-samples 2.3.0 → 2.3.151-test.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.
Files changed (117) hide show
  1. package/DashPath/App.vue +17 -16
  2. package/DashPath/AppForOperator.vue +2 -4
  3. package/DemoForOperator/AnimPic/AnimPic.vue +24 -2
  4. package/DemoForOperator/Banger/Banger/Banger.vue +73 -9
  5. package/DemoForOperator/Blur/Blur.vue +146 -0
  6. package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +158 -0
  7. package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
  8. package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
  9. package/DemoForOperator/BookFlip/App.vue +115 -0
  10. package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
  11. package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
  12. package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -0
  13. package/DemoForOperator/BookFlip/BookPage.vue +82 -0
  14. package/DemoForOperator/Bounce/Bounce.vue +33 -1
  15. package/DemoForOperator/ChunLian/Couplets.vue +44 -1
  16. package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
  17. package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
  18. package/DemoForOperator/DominantColor/App.vue +187 -0
  19. package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +0 -3
  20. package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +76 -2
  21. package/DemoForOperator/Firework1/App.vue +1 -1
  22. package/DemoForOperator/Firework1/Fireworks.vue +50 -11
  23. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +29 -1
  24. package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +27 -2
  25. package/DemoForOperator/Focus/Light/LightFocusBox.vue +42 -1
  26. package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +12 -0
  27. package/DemoForOperator/FrameShadow/App.vue +193 -0
  28. package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
  29. package/DemoForOperator/FullscreenIn/App.vue +1 -1
  30. package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +18 -3
  31. package/DemoForOperator/Genie/geniePakcer/Genie.vue +60 -18
  32. package/DemoForOperator/GrayFilter/GrayFilter.vue +21 -0
  33. package/DemoForOperator/Jigsaw/JigsawFull.vue +46 -4
  34. package/DemoForOperator/Jigsaw/JigsawSingle.vue +34 -2
  35. package/DemoForOperator/LongChatBox/App.vue +36 -0
  36. package/DemoForOperator/LongChatBox/Bubble.vue +104 -0
  37. package/DemoForOperator/LongChatBox/LongChat.vue +173 -0
  38. package/DemoForOperator/LongChatBox/TextManager.ts +147 -0
  39. package/DemoForOperator/LongChatBox/VirtualList.vue +298 -0
  40. package/DemoForOperator/LongChatBox/testData.js +51 -0
  41. package/DemoForOperator/LongChatBox/utile.js +331 -0
  42. package/DemoForOperator/Particle/Drop/DropParticle.vue +33 -1
  43. package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +23 -2
  44. package/DemoForOperator/PosterAnim/PosterAnim.js +21 -0
  45. package/DemoForOperator/PosterOverflow/PosterOverflow.vue +16 -0
  46. package/DemoForOperator/Resize/App.vue +157 -0
  47. package/DemoForOperator/Resize/Resize/Item.vue +234 -0
  48. package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
  49. package/DemoForOperator/Ripple/Ripple.vue +16 -1
  50. package/DemoForOperator/ScreenShootScale/App.vue +96 -0
  51. package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
  52. package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
  53. package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
  54. package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
  55. package/DemoForOperator/SmoothSwiper/App.vue +50 -0
  56. package/DemoForOperator/Sound/Bounce/App.vue +56 -0
  57. package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
  58. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
  59. package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
  60. package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
  61. package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
  62. package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
  63. package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
  64. package/DemoForOperator/Sound/Rain/App.vue +11 -0
  65. package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
  66. package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
  67. package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
  68. package/DemoForOperator/Sound/Sound/index.js +4 -0
  69. package/DemoForOperator/Sound/Sound/useSound.js +112 -0
  70. package/DemoForOperator/Sprite/Sprite.vue +62 -5
  71. package/DemoForOperator/Stretch/Stretch/Stretch.vue +52 -2
  72. package/DemoForOperator/Swiper/App.vue +101 -0
  73. package/DemoForOperator/Swiper/Item.vue +56 -0
  74. package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
  75. package/DemoForOperator/TabContent/TabContent/TabContent.vue +39 -1
  76. package/DemoForOperator/TabContentVertical/App.vue +104 -0
  77. package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
  78. package/DemoForOperator/TabContentVertical/Item.vue +94 -0
  79. package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
  80. package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
  81. package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
  82. package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
  83. package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
  84. package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
  85. package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
  86. package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
  87. package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
  88. package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
  89. package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
  90. package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
  91. package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
  92. package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
  93. package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
  94. package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
  95. package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
  96. package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
  97. package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
  98. package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
  99. package/DemoForOperator/TabContentVertical/testData.js +76 -0
  100. package/DemoForOperator/Vortex/Vortex/Vortex.vue +26 -0
  101. package/DemoForOperator/routeList.js +118 -1
  102. package/DemoHomepage/components/Item.vue +11 -0
  103. package/DemoHomepage/router.js +75 -1
  104. package/GiftRain/components/SpriteTranslate.vue +68 -48
  105. package/HashHistory/App.vue +2 -2
  106. package/HashHistory/router.js +1 -1
  107. package/MetroWidgetDemos/TripleWidget/App.vue +7 -1
  108. package/MetroWidgetDemos/TripleWidget/Item.vue +16 -2
  109. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +7 -1
  110. package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +8 -2
  111. package/MetroWidgetDemos/routeList.js +17 -0
  112. package/PosterPacker/App.vue +2 -2
  113. package/ViewOpacity/App.vue +19 -0
  114. package/package.json +1 -1
  115. package/DashPath/DashPath.vue +0 -118
  116. package/DemoForOperator/ScalePoster/App.vue +0 -4
  117. package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
@@ -0,0 +1,193 @@
1
+ <template>
2
+ <div>
3
+ <div :style="{ width: 1280, height: 720, backgroundColor: '#FFF0F0' }" />
4
+ <div :style="{ left: 100, top: 100 }">
5
+ <FrameShadow
6
+ :width="vTargetRectWidth"
7
+ :height="vTargetRectHeight"
8
+ :borderRadius="vTargetRectRaidus"
9
+ />
10
+ <JsvFlexDiv
11
+ :style="{
12
+ width: vTargetRectWidth,
13
+ height: vTargetRectHeight,
14
+ alignItems: 'center',
15
+ backgroundColor: 'rgba(128, 128, 0, 0.5)',
16
+ borderRadius: vTargetRectRaidus,
17
+ }"
18
+ >
19
+ <div
20
+ :style="{
21
+ width: vTargetRectWidth,
22
+ textAlign: 'center',
23
+ fontSize: 10,
24
+ lineHeight: 12,
25
+ }"
26
+ >
27
+ {{ `圆角为${vTargetRectRaidus}的矩形` }}
28
+ </div>
29
+ </JsvFlexDiv>
30
+ </div>
31
+ <div :style="{ left: 450, top: 100 }">
32
+ <FrameShadow
33
+ :width="vTargetRectWidth1"
34
+ :height="vTargetRectHeight1"
35
+ :borderRadius="vTargetRectRaidus1"
36
+ />
37
+ <JsvFlexDiv
38
+ :style="{
39
+ width: vTargetRectWidth1,
40
+ height: vTargetRectHeight1,
41
+ alignItems: 'center',
42
+ backgroundColor: 'rgba(128, 128, 0, 0.5)',
43
+ borderRadius: vTargetRectRaidus1,
44
+ }"
45
+ >
46
+ <div
47
+ :style="{
48
+ width: vTargetRectWidth1,
49
+ textAlign: 'center',
50
+ fontSize: 10,
51
+ lineHeight: 12,
52
+ }"
53
+ >
54
+ {{ `圆角为${vTargetRectRaidus1}的矩形` }}
55
+ </div>
56
+ </JsvFlexDiv>
57
+ </div>
58
+ <div :style="{ left: 800, top: 100 }">
59
+ <FrameShadow
60
+ :width="vTargetRectWidth2"
61
+ :height="vTargetRectHeight2"
62
+ :borderRadius="vTargetRectRaidus2"
63
+ />
64
+ <JsvFlexDiv
65
+ :style="{
66
+ width: vTargetRectWidth2,
67
+ height: vTargetRectHeight2,
68
+ alignItems: 'center',
69
+ backgroundColor: 'rgba(128, 128, 0, 0.5)',
70
+ borderRadius: vTargetRectRaidus2,
71
+ }"
72
+ >
73
+ <div
74
+ :style="{
75
+ width: vTargetRectWidth2,
76
+ textAlign: 'center',
77
+ fontSize: 10,
78
+ lineHeight: 12,
79
+ }"
80
+ >
81
+ {{ `圆角为${vTargetRectRaidus2}的矩形` }}
82
+ </div>
83
+ </JsvFlexDiv>
84
+ </div>
85
+
86
+ <div :style="{ left: 100, top: 400 }">
87
+ <FrameShadow
88
+ :width="vTargetRectWidth"
89
+ :height="vTargetRectHeight"
90
+ :borderRadius="vTargetRectRaidus"
91
+ type="down"
92
+ />
93
+ <JsvFlexDiv
94
+ :style="{
95
+ width: vTargetRectWidth,
96
+ height: vTargetRectHeight,
97
+ alignItems: 'center',
98
+ backgroundColor: 'rgba(128, 128, 0, 0.5)',
99
+ borderRadius: vTargetRectRaidus,
100
+ }"
101
+ >
102
+ <div
103
+ :style="{
104
+ width: vTargetRectWidth,
105
+ textAlign: 'center',
106
+ fontSize: 10,
107
+ lineHeight: 12,
108
+ }"
109
+ >
110
+ {{ `圆角为${vTargetRectRaidus}的矩形` }}
111
+ </div>
112
+ </JsvFlexDiv>
113
+ </div>
114
+
115
+ <div :style="{ left: 450, top: 400 }">
116
+ <FrameShadow
117
+ :width="vTargetRectWidth1"
118
+ :height="vTargetRectHeight1"
119
+ :borderRadius="vTargetRectRaidus1"
120
+ type="down"
121
+ />
122
+ <JsvFlexDiv
123
+ :style="{
124
+ width: vTargetRectWidth1,
125
+ height: vTargetRectHeight1,
126
+ alignItems: 'center',
127
+ backgroundColor: 'rgba(128, 128, 0, 0.5)',
128
+ borderRadius: vTargetRectRaidus1,
129
+ }"
130
+ >
131
+ <div
132
+ :style="{
133
+ width: vTargetRectWidth1,
134
+ textAlign: 'center',
135
+ fontSize: 10,
136
+ lineHeight: 12,
137
+ }"
138
+ >
139
+ {{ `圆角为${vTargetRectRaidus1}的矩形` }}
140
+ </div>
141
+ </JsvFlexDiv>
142
+ </div>
143
+
144
+ <div :style="{ left: 800, top: 400 }">
145
+ <FrameShadow
146
+ :width="vTargetRectWidth2"
147
+ :height="vTargetRectHeight2"
148
+ :borderRadius="vTargetRectRaidus2"
149
+ type="down"
150
+ />
151
+ <JsvFlexDiv
152
+ :style="{
153
+ width: vTargetRectWidth2,
154
+ height: vTargetRectHeight2,
155
+ alignItems: 'center',
156
+ backgroundColor: 'rgba(128, 128, 0, 0.5)',
157
+ borderRadius: vTargetRectRaidus2,
158
+ }"
159
+ >
160
+ <div
161
+ :style="{
162
+ width: vTargetRectWidth2,
163
+ textAlign: 'center',
164
+ fontSize: 10,
165
+ lineHeight: 12,
166
+ }"
167
+ >
168
+ {{ `圆角为${vTargetRectRaidus2}的矩形` }}
169
+ </div>
170
+ </JsvFlexDiv>
171
+ </div>
172
+ </div>
173
+ </template>
174
+
175
+ <script setup>
176
+ import { JsvFlexDiv } from "jsview";
177
+ import FrameShadow from "./FrameShadow.vue";
178
+
179
+ // 圆角为45的矩形样例
180
+ const vTargetRectWidth = 250; // 需要对齐区域的矩形宽
181
+ const vTargetRectHeight = 150; // 需要对齐区域的矩形高
182
+ const vTargetRectRaidus = 45; // 需要对齐区域的圆角半径,请和圆环内径对应的半径一致才能套齐
183
+
184
+ // 圆角为13的矩形样例
185
+ const vTargetRectWidth1 = 250; // 需要对齐区域的矩形宽
186
+ const vTargetRectHeight1 = 150; // 需要对齐区域的矩形高
187
+ const vTargetRectRaidus1 = 13; // 需要对齐区域的圆角半径,请和圆环内径对应的半径一致才能套齐
188
+
189
+ // 最小圆角尺寸样例,在此框架下不能低于4
190
+ const vTargetRectWidth2 = 250; // 需要对齐区域的矩形宽
191
+ const vTargetRectHeight2 = 150; // 需要对齐区域的矩形高
192
+ const vTargetRectRaidus2 = 4; // 需要对齐区域的圆角半径,请和圆环内径对应的半径一致才能套齐
193
+ </script>
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div>
3
+ <JsvNinePatch
4
+ :style="{
5
+ width: props.width,
6
+ height: props.height,
7
+ }"
8
+ :imageUrl="vImageUrl"
9
+ :imageWidth="vImageWidth"
10
+ :centerWidth="cCenterWidth"
11
+ :imageDspWidth="vImageDspWidth"
12
+ :borderOutset="vBorderOutset"
13
+ />
14
+ </div>
15
+ </template>
16
+
17
+ <script setup>
18
+ import { JsvNinePatch } from "jsview";
19
+
20
+ // 接收宽高作为props
21
+ const props = defineProps({
22
+ width: {
23
+ type: Number,
24
+ required: true,
25
+ },
26
+ height: {
27
+ type: Number,
28
+ required: true,
29
+ },
30
+ borderRadius: {
31
+ type: Number,
32
+ required: true,
33
+ },
34
+ type: {
35
+ type: String,
36
+ default: "surround",
37
+ },
38
+ });
39
+
40
+ // 图片资源映射
41
+ const cImageMaps = {
42
+ surround:
43
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources-2/DemoForOperator/FrameShadow/FrameShadow.png",
44
+ down: "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources-2/DemoForOperator/FrameShadow/FrameShadow-down.png",
45
+ };
46
+ const vImageUrl = cImageMaps[props.type];
47
+ if (vImageUrl === undefined) {
48
+ vImageUrl = cImageMaps["surround"];
49
+ }
50
+
51
+ // 图片固定属性
52
+ const cInnerRadius2 = 92; // 原始图片的内直径(也是右边图矩形的边长值)
53
+ const cCenterWidth = 2; // 图片的中心repeat宽度
54
+ const cInnerRadius = (cInnerRadius2 - cCenterWidth) / 2; // 原始图片圆角半径
55
+ const cSampleImageWidth = 200; // 原始图形的画布尺寸,画布为正方形
56
+
57
+ // 计算后的对应NinePatch参数
58
+ let vBorderOutset = (cSampleImageWidth - cInnerRadius2) / 2; // 设置值为图片长度减去内直径除以2
59
+ let vImageWidth = cSampleImageWidth; // 原图尺寸设置
60
+ let vImageDspWidth = (props.borderRadius / cInnerRadius) * cSampleImageWidth; // 显示图尺寸,当想复用目标图片,但是半径又不想等时才和原图不一样
61
+ </script>
@@ -100,6 +100,6 @@ onMounted(() => {
100
100
  v-if="fullScreenVisibility"
101
101
  :src="imageUrl"
102
102
  :width="1280"
103
- :duration="800"
103
+ :duration="0.8"
104
104
  ></fullscreen-poster>
105
105
  </template>
@@ -10,24 +10,39 @@
10
10
 
11
11
  <script setup>
12
12
  const props = defineProps({
13
+ /**
14
+ * 图片资源地址
15
+ * @type {String}
16
+ * @required
17
+ */
13
18
  src: {
14
19
  type: String,
15
20
  required: true,
16
21
  },
22
+ /**
23
+ * 动画持续时间(单位:秒)
24
+ * @type {Number}
25
+ * @default 0.8
26
+ */
17
27
  duration: {
18
28
  type: Number,
19
- default: 800,
29
+ default: 0.8,
20
30
  },
31
+ /**
32
+ * 图片显示宽度(单位:像素)
33
+ * @type {Number}
34
+ * @required
35
+ */
21
36
  width: {
22
37
  type: Number,
23
38
  required: true,
24
39
  },
25
40
  });
26
41
 
27
- const animStr = `fade-in ${props.duration / 1000}s`;
42
+ const animStr = `fade-in ${props.duration}s`;
28
43
  </script>
29
44
 
30
- <style scopped>
45
+ <style scoped>
31
46
  @keyframes fade-in {
32
47
  from {
33
48
  opacity: 0;
@@ -1,22 +1,4 @@
1
1
  <script setup>
2
- /**
3
- * @file Genie组件说明
4
- * Genie:收缩或者放出效果的组件
5
- * props说明:
6
- * @prop {Number} width (必填) 组件的基础宽度
7
- * @prop {Number} height (必填) 组件的基础高度
8
- * @prop {Number} top (非必填) 组件的基础top
9
- * @prop {Number} left (非必填) 组件的基础left
10
- * @prop {Number} time (非必填) 组件的动画时长
11
- * @prop {Object} position (必填) 组件收缩点的坐标
12
- * @prop {String} direction (必填) 组件动画方向
13
- * @prop {Function} animationEnd (非必填) 组件做完一次动画后的回调
14
- * @prop {Boolean} initShow (必填) 组件初始状态
15
- * methods:
16
- * @method switcher 暴露出去的方法 交替组件内部显示情况
17
- *
18
- */
19
-
20
2
  import genieLeft from "./genieLeft.glsl?raw";
21
3
  import genieRight from "./genieRight.glsl?raw";
22
4
  import genieBottom from "./genieBottom.glsl?raw";
@@ -35,15 +17,71 @@ import {
35
17
  JsvTextureStoreApi,
36
18
  } from "jsview";
37
19
  const props = defineProps({
20
+ /**
21
+ * 组件宽度(必填)
22
+ * @type {Number}
23
+ */
38
24
  width: { type: Number, require: true },
25
+
26
+ /**
27
+ * 组件高度(必填)
28
+ * @type {Number}
29
+ */
39
30
  height: { type: Number, require: true },
31
+
32
+ /**
33
+ * 左侧定位位置
34
+ * @type {Number}
35
+ * @default 0
36
+ */
40
37
  left: { type: Number, default: 0 },
38
+
39
+ /**
40
+ * 顶部定位位置
41
+ * @type {Number}
42
+ * @default 0
43
+ */
41
44
  top: { type: Number, default: 0 },
45
+
46
+ /**
47
+ * 动画持续时间(秒)
48
+ * @type {Number}
49
+ * @default 2
50
+ */
42
51
  time: { type: Number, default: 2 },
52
+
53
+ /**
54
+ * 动画中心点坐标(必填)
55
+ * @type {Object}
56
+ * @property {Number} x - X轴坐标
57
+ * @property {Number} y - Y轴坐标
58
+ */
43
59
  position: { type: Object, require: true },
60
+
61
+ /**
62
+ * 缩放比例
63
+ * @type {Number}
64
+ * @default 1
65
+ */
44
66
  size: { type: Number, default: 1 },
67
+
68
+ /**
69
+ * 动画方向(必填)
70
+ * @type {'horizontal'|'vertical'}
71
+ */
45
72
  direction: { type: String, require: true },
73
+
74
+ /**
75
+ * 动画结束回调函数
76
+ * @type {Function}
77
+ * @default () => {}
78
+ */
46
79
  onAnimEnd: { type: Function, default: () => {} },
80
+
81
+ /**
82
+ * 初始显示状态(必填)
83
+ * @type {Boolean}
84
+ */
47
85
  initShow: { type: Boolean, require: true },
48
86
  });
49
87
 
@@ -633,6 +671,10 @@ onBeforeUnmount(() => {
633
671
  });
634
672
 
635
673
  defineExpose({
674
+ /**
675
+ * 触发精灵动画切换
676
+ * 执行截屏并启动收缩/展开动画
677
+ */
636
678
  switcher,
637
679
  });
638
680
  </script>
@@ -9,18 +9,38 @@ import { JsvFilterView } from "jsview";
9
9
  import { shallowRef, watchEffect } from "vue";
10
10
 
11
11
  const props = defineProps({
12
+ /**
13
+ * 控制是否开启灰色滤镜
14
+ * @type {Boolean}
15
+ */
12
16
  open: {
13
17
  type: Boolean,
14
18
  },
19
+ /**
20
+ * 组件宽度
21
+ * @type {Number}
22
+ */
15
23
  width: {
16
24
  type: Number,
17
25
  },
26
+ /**
27
+ * 组件高度
28
+ * @type {Number}
29
+ */
18
30
  height: {
19
31
  type: Number,
20
32
  },
33
+ /**
34
+ * 距离左侧的位置
35
+ * @type {Number}
36
+ */
21
37
  left: {
22
38
  type: Number,
23
39
  },
40
+ /**
41
+ * 距离顶部的位置
42
+ * @type {Number}
43
+ */
24
44
  top: {
25
45
  type: Number,
26
46
  }
@@ -28,6 +48,7 @@ const props = defineProps({
28
48
 
29
49
  const filterType = shallowRef(props.open ? "gray-down" : null);
30
50
 
51
+ // 监听open属性变化更新滤镜类型
31
52
  watchEffect(() => {
32
53
  if (props.open) {
33
54
  filterType.value = "gray-down";
@@ -39,22 +39,51 @@ import { shallowRef } from "vue";
39
39
  import { JsvMaskClipDiv, JsvPreload, buildPreloadInfo } from "jsview";
40
40
 
41
41
  const props = defineProps({
42
- //每一片的配置, 格式 { pieces: [{file: "", left: 0, top: 0, width: 0, height: 0}]}
43
- //注意, mask的图片资源和json在同目录下
42
+ /**
43
+ * 拼图遮罩配置文件的URL
44
+ * @type {String}
45
+ * @description 配置文件格式:{ pieces: [{file: "", left: 0, top: 0, width: 0, height: 0}] }
46
+ * 注意:mask的图片资源需要和json配置文件放在同目录下
47
+ */
44
48
  configUrl: {
45
49
  type: String,
46
50
  },
51
+
52
+ /**
53
+ * 组件显示尺寸
54
+ * @type {Object}
55
+ * @property {number} width - 组件宽度
56
+ * @property {number} height - 组件高度
57
+ */
47
58
  size: {
48
59
  type: Object,
49
60
  },
50
- //每一片的显示设置, 0表示不显示, 1表示显示
61
+
62
+ /**
63
+ * 碎片显示控制数组
64
+ * @type {Array<number>}
65
+ * @description 数组元素值为0表示隐藏对应碎片,1表示显示对应碎片
66
+ * 数组索引对应maskConfig的索引
67
+ */
51
68
  displaySetting: {
52
69
  type: Array,
53
70
  },
54
- //图片信息, 格式 { src: "", width: 0, height: 0 }
71
+
72
+ /**
73
+ * 底图信息
74
+ * @type {Object}
75
+ * @property {string} src - 图片URL
76
+ * @property {number} width - 图片原始宽度
77
+ * @property {number} height - 图片原始高度
78
+ */
55
79
  imgInfo: {
56
80
  type: Object,
57
81
  },
82
+
83
+ /**
84
+ * 描边效果图片URL
85
+ * @type {String}
86
+ */
58
87
  strokeSrc: {
59
88
  type: String,
60
89
  },
@@ -65,15 +94,27 @@ const showComponent = shallowRef(false);
65
94
  const preloadList = [];
66
95
  const maskConfig = [];
67
96
 
97
+ /**
98
+ * 预加载完成回调
99
+ */
68
100
  function preloadDone() {
69
101
  showComponent.value = true;
70
102
  }
71
103
 
104
+ /**
105
+ * 准备资源加载
106
+ * @description 执行流程:
107
+ * 1. 加载底图和描边图
108
+ * 2. 获取遮罩配置文件
109
+ * 3. 构建预加载列表
110
+ * 4. 显示预加载组件
111
+ */
72
112
  function prepareSrc() {
73
113
  preloadList.push(buildPreloadInfo(props.imgInfo.src));
74
114
  if (props.strokeSrc) {
75
115
  preloadList.push(buildPreloadInfo(props.strokeSrc));
76
116
  }
117
+
77
118
  fetch(props.configUrl)
78
119
  .then((res) => res.json())
79
120
  .then((data) => {
@@ -96,5 +137,6 @@ function prepareSrc() {
96
137
  console.log("fetch mask config failed", err);
97
138
  });
98
139
  }
140
+
99
141
  prepareSrc();
100
142
  </script>
@@ -27,18 +27,50 @@
27
27
  import { shallowRef } from "vue";
28
28
  import { JsvMaskClipDiv, JsvPreload, buildPreloadInfo } from "jsview";
29
29
 
30
- //只显示一片的demo
30
+ /**
31
+ * 拼图单一片组件
32
+ */
31
33
  const props = defineProps({
34
+ /**
35
+ * @type {String} 拼图配置文件URL
36
+ * @description 拼图配置文件地址,格式为JSON对象包含pieces数组
37
+ * @example {
38
+ * pieces: [
39
+ * {file: "piece1.png", left: 0, top: 0, width: 100, height: 100}
40
+ * ]
41
+ * }
42
+ */
32
43
  configUrl: {
33
- //每一片的配置, 格式 { pieces: [{file: "", left: 0, top: 0, width: 0, height: 0}]}
34
44
  type: String,
35
45
  },
46
+
47
+ /**
48
+ * @type {Number} 当前显示的拼图片索引
49
+ * @description 指定要显示的拼图片在pieces数组中的位置
50
+ * @example 0 表示显示第一个拼图片
51
+ */
36
52
  pieceIndex: {
37
53
  type: Number,
38
54
  },
55
+
56
+ /**
57
+ * @type {Object} 容器尺寸
58
+ * @description 包含width和height属性的对象,用于调整拼图片显示尺寸
59
+ * @example { width: 300, height: 200 }
60
+ */
39
61
  size: {
40
62
  type: Object,
41
63
  },
64
+
65
+ /**
66
+ * @type {Object} 图片信息
67
+ * @description 包含图片源和原始尺寸的对象
68
+ * @example {
69
+ * src: "image.jpg",
70
+ * width: 1920,
71
+ * height: 1080
72
+ * }
73
+ */
42
74
  imgInfo: {
43
75
  type: Object,
44
76
  },
@@ -0,0 +1,36 @@
1
+ <script setup>
2
+ import { ref } from "vue";
3
+ import LongChat from "./LongChat.vue";
4
+ </script>
5
+
6
+ <template>
7
+ <div
8
+ :style="{
9
+ width: 1280,
10
+ height: 720,
11
+ backgroundColor: '#666',
12
+ }"
13
+ >
14
+ <div
15
+ :style="{
16
+ top: 50,
17
+ width: 1280,
18
+ height: 600,
19
+ overflow: 'hidden',
20
+ }"
21
+ >
22
+ <LongChat />
23
+ </div>
24
+ <div
25
+ :style="{
26
+ width: 1280,
27
+ height: 50,
28
+ backgroundColor: '#666',
29
+ fontSize: 30,
30
+ color: '#fff',
31
+ }"
32
+ >
33
+ 按ok键开始生成, 按上下键滚动
34
+ </div>
35
+ </div>
36
+ </template>