officialblock 1.0.7 → 1.0.9

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 (103) hide show
  1. package/dist/index-Ch_ldWmA.js +1 -0
  2. package/dist/index-DXm2cqxo.mjs +485 -0
  3. package/dist/official-block.cjs.js +74 -74
  4. package/dist/official-block.es.js +13608 -10831
  5. package/dist/official-block.umd.js +78 -78
  6. package/dist/style.css +1 -1
  7. package/dist/swiper-JiLDDxAF.js +1 -0
  8. package/dist/swiper-acbnDJoL.mjs +2035 -0
  9. package/dist/utils-DD-vVZej.mjs +316 -0
  10. package/dist/utils-DOLLD0-F.js +1 -0
  11. package/package.json +2 -1
  12. package/src/assets/icon-email.svg +3 -0
  13. package/src/components/ArticleList/article.vue +3 -3
  14. package/src/components/ArticleList/contact.vue +9 -9
  15. package/src/components/ArticleList/index.ts +1 -1
  16. package/src/components/ArticleList/index.vue +22 -80
  17. package/src/components/ArticleList/setting.vue +339 -175
  18. package/src/components/ArticleList/type.ts +12 -18
  19. package/src/components/BannerImage/index.ts +11 -0
  20. package/src/components/BannerImage/index.vue +153 -0
  21. package/src/components/BannerImage/setting.vue +55 -0
  22. package/src/components/BannerImage/type.ts +10 -0
  23. package/src/components/BannerImageWithLink/index.ts +11 -0
  24. package/src/components/BannerImageWithLink/index.vue +323 -0
  25. package/src/components/BannerImageWithLink/setting.vue +344 -0
  26. package/src/components/BannerImageWithLink/type.ts +17 -0
  27. package/src/components/BannerPage/index.ts +11 -0
  28. package/src/components/BannerPage/index.vue +283 -0
  29. package/src/components/BannerPage/setting.vue +55 -0
  30. package/src/components/BannerPage/type.ts +10 -0
  31. package/src/components/BtnList/index.ts +11 -0
  32. package/src/components/BtnList/index.vue +588 -0
  33. package/src/components/BtnList/setting.vue +255 -0
  34. package/src/components/BtnList/type.ts +10 -0
  35. package/src/components/Button/index.vue +45 -33
  36. package/src/components/ContactUsList/index.ts +11 -0
  37. package/src/components/ContactUsList/index.vue +369 -0
  38. package/src/components/ContactUsList/setting.vue +497 -0
  39. package/src/components/ContactUsList/type.ts +17 -0
  40. package/src/components/CountDown/index.ts +11 -0
  41. package/src/components/CountDown/index.vue +315 -0
  42. package/src/components/CountDown/setting.vue +302 -0
  43. package/src/components/CountDown/type.ts +17 -0
  44. package/src/components/CustomIframe/index.ts +11 -0
  45. package/src/components/CustomIframe/index.vue +118 -0
  46. package/src/components/CustomIframe/setting.vue +323 -0
  47. package/src/components/CustomIframe/type.ts +17 -0
  48. package/src/components/CustomSpace/index.ts +11 -0
  49. package/src/components/CustomSpace/index.vue +82 -0
  50. package/src/components/CustomSpace/setting.vue +89 -0
  51. package/src/components/CustomSpace/type.ts +10 -0
  52. package/src/components/GalleryList/index.ts +12 -0
  53. package/src/components/GalleryList/index.vue +311 -0
  54. package/src/components/GalleryList/setting.vue +268 -0
  55. package/src/components/GalleryList/type.ts +10 -0
  56. package/src/components/HeroSlide/index.ts +1 -1
  57. package/src/components/HeroSlide/index.vue +85 -133
  58. package/src/components/HeroSlide/setting.vue +435 -0
  59. package/src/components/HeroSlide/type.ts +5 -14
  60. package/src/components/LinkLIst/index.ts +11 -0
  61. package/src/components/LinkLIst/index.vue +317 -0
  62. package/src/components/LinkLIst/setting.vue +264 -0
  63. package/src/components/LinkLIst/type.ts +10 -0
  64. package/src/components/Media/index.vue +18 -18
  65. package/src/components/Operate/index.vue +17 -8
  66. package/src/components/Profile/index.vue +999 -0
  67. package/src/components/Profile/modal.vue +56 -0
  68. package/src/components/Profile/setting.vue +330 -0
  69. package/src/components/QuickLinks/index.vue +166 -0
  70. package/src/components/QuoteText/index.ts +11 -0
  71. package/src/components/QuoteText/index.vue +133 -0
  72. package/src/components/QuoteText/setting.vue +81 -0
  73. package/src/components/QuoteText/type.ts +10 -0
  74. package/src/components/ScrollKeyInfo/index.ts +11 -0
  75. package/src/components/ScrollKeyInfo/index.vue +1345 -0
  76. package/src/components/ScrollKeyInfo/setting.vue +302 -0
  77. package/src/components/ScrollKeyInfo/type.ts +17 -0
  78. package/src/components/Swiper/index.vue +538 -0
  79. package/src/components/TabDefault/components/ComponentSelector/compsData.js +143 -0
  80. package/src/components/TabDefault/components/ComponentSelector/index.vue +188 -0
  81. package/src/components/TabDefault/components/PageContent.vue +207 -0
  82. package/src/components/TabDefault/index.vue +475 -0
  83. package/src/components/TabDefault/setting.vue +581 -0
  84. package/src/components/TabDefault/type.ts +17 -0
  85. package/src/components/TableTwo/index.ts +11 -0
  86. package/src/components/TableTwo/index.vue +232 -0
  87. package/src/components/TableTwo/setting.vue +558 -0
  88. package/src/components/TableTwo/type.ts +17 -0
  89. package/src/components/index.ts +40 -5
  90. package/src/index.ts +56 -12
  91. package/src/main.ts +6 -3
  92. package/src/router/index.ts +6 -0
  93. package/src/style.css +17 -0
  94. package/src/styles/component-isolation.scss +257 -0
  95. package/src/styles/editor.scss +1 -1
  96. package/src/styles/layers.scss +256 -0
  97. package/src/styles/main.scss +21687 -0
  98. package/src/styles/mixins/style-isolation.scss +262 -0
  99. package/src/styles/smart-reset.scss +287 -0
  100. package/src/styles/test.scss +1 -1
  101. package/src/types/button.ts +10 -0
  102. package/src/views/StyleIsolationTest.vue +292 -0
  103. package/src/views/components/ArticleListDemo.vue +59 -19
@@ -1,8 +1,12 @@
1
1
  <template>
2
- <a-drawer :width="500" :visible="show" :footer="false" @cancel="handleCancel" unmountOnClose>
3
- <template #title>
4
- {{data.type}}组件编辑
5
- </template>
2
+ <a-drawer
3
+ :width="500"
4
+ :visible="show"
5
+ :footer="false"
6
+ @cancel="handleCancel"
7
+ unmountOnClose
8
+ >
9
+ <template #title> {{ data.type }}组件编辑 </template>
6
10
  <div class="setting-content">
7
11
  <!-- 组件自身属性 -->
8
12
  <div class="setting-header flex items-center">
@@ -23,11 +27,21 @@
23
27
  </div>
24
28
 
25
29
  <a-button-group type="primary">
26
- <a-button size="mini" @click="handleAdd('Article')"><template #icon><icon-plus /></template> Article </a-button>
27
- <a-button size="mini" @click="handleAdd('Contact')"><template #icon><icon-plus /></template> Contact </a-button>
28
- <a-button size="mini" @click="handleAdd('Image')"><template #icon><icon-plus /></template> Image </a-button>
29
- <a-button size="mini" @click="handleAdd('ImageList')"><template #icon><icon-plus /></template> ImageList </a-button>
30
- <a-button size="mini" @click="handleAdd('Video')"><template #icon><icon-plus /></template> Video </a-button>
30
+ <a-button size="mini" @click="handleAdd('Article')"
31
+ ><template #icon><icon-plus /></template> Article
32
+ </a-button>
33
+ <a-button size="mini" @click="handleAdd('Contact')"
34
+ ><template #icon><icon-plus /></template> Contact
35
+ </a-button>
36
+ <a-button size="mini" @click="handleAdd('Image')"
37
+ ><template #icon><icon-plus /></template> Image
38
+ </a-button>
39
+ <a-button size="mini" @click="handleAdd('ImageList')"
40
+ ><template #icon><icon-plus /></template> ImageList
41
+ </a-button>
42
+ <a-button size="mini" @click="handleAdd('Video')"
43
+ ><template #icon><icon-plus /></template> Video
44
+ </a-button>
31
45
  </a-button-group>
32
46
 
33
47
  <!-- 子组件属性 -->
@@ -37,7 +51,7 @@
37
51
  :component-data="{
38
52
  tag: 'div',
39
53
  type: 'transition-group',
40
- name: !drag ? 'flip-list' : null
54
+ name: !drag ? 'flip-list' : null,
41
55
  }"
42
56
  v-bind="dragOptions"
43
57
  @start="drag = true"
@@ -51,26 +65,33 @@
51
65
  <div class="drag-handle">
52
66
  <icon-drag-arrow class="drag-icon" />
53
67
  </div>
54
- <icon-delete class="btn-delete" @click="handleDelete(item.id)" />
68
+ <icon-delete
69
+ class="btn-delete"
70
+ @click="handleDelete(item.id)"
71
+ />
55
72
  </div>
56
73
 
57
74
  <template v-if="item.type === 'Article'">
58
75
  <p class="item-title">标题</p>
59
- <a-input v-model="item.data.title" placeholder="请输入标题" allow-clear />
76
+ <a-input
77
+ v-model="item.title"
78
+ placeholder="请输入标题"
79
+ allow-clear
80
+ />
60
81
 
61
82
  <p class="item-title">内容</p>
62
- <RichTextEditor v-model="item.data.content"></RichTextEditor>
83
+ <RichTextEditor v-model="item.content"></RichTextEditor>
63
84
 
64
85
  <p class="item-title">按钮</p>
65
86
  <draggable
66
- v-model="item.data.buttonList"
87
+ v-model="item.buttonList"
67
88
  :component-data="{
68
89
  tag: 'div',
69
90
  type: 'transition-group',
70
- name: !drag ? 'flip-list' : null
91
+ name: !drag ? 'flip-list' : null,
71
92
  }"
72
93
  v-bind="buttonDragOptions"
73
- :disabled="!shouldShowDragHandle(item.data.buttonList)"
94
+ :disabled="!shouldShowDragHandle(item.buttonList)"
74
95
  @start="drag = true"
75
96
  @end="drag = false"
76
97
  item-key="id"
@@ -78,42 +99,65 @@
78
99
  <template #item="{ element: button }">
79
100
  <div
80
101
  class="item-button draggable-item"
81
- :class="{ 'sortable-disabled': !shouldShowDragHandle(item.data.buttonList) }"
102
+ :class="{
103
+ 'sortable-disabled': !shouldShowDragHandle(
104
+ item.buttonList
105
+ ),
106
+ }"
82
107
  :key="button.id"
83
108
  >
84
109
  <div class="btn-group">
85
110
  <div
86
- v-if="shouldShowDragHandle(item.data.buttonList)"
111
+ v-if="shouldShowDragHandle(item.buttonList)"
87
112
  class="drag-handle"
88
113
  >
89
114
  <icon-drag-arrow class="drag-icon" />
90
115
  </div>
91
- <icon-delete class="btn-delete" @click="handleDeleteButton(item.data.buttonList, button.id)" />
116
+ <icon-delete
117
+ class="btn-delete"
118
+ @click="
119
+ handleDeleteButton(item.buttonList, button.id)
120
+ "
121
+ />
92
122
  </div>
93
123
  <a-button type="primary">{{ button.text }}</a-button>
94
124
  <div class="item-action flex items-center">
95
- <a-input class="action-text" v-model="button.text" placeholder="按钮文本" allow-clear />
96
- <a-input v-model="button.url" placeholder="按钮链接" allow-clear />
125
+ <a-input
126
+ class="action-text"
127
+ v-model="button.text"
128
+ placeholder="按钮文本"
129
+ allow-clear
130
+ />
131
+ <a-input
132
+ v-model="button.url"
133
+ placeholder="按钮链接"
134
+ allow-clear
135
+ />
97
136
  </div>
98
- <a-checkbox :model-value="button.isExternal">是否外部链接</a-checkbox>
137
+ <a-checkbox :model-value="button.isExternal"
138
+ >是否外部链接</a-checkbox
139
+ >
99
140
  </div>
100
141
  </template>
101
142
  </draggable>
102
- <div class="item-add-btn flex items-center" @click="handleAddButton(item.data.buttonList)">
143
+ <div
144
+ class="item-add-btn flex items-center"
145
+ @click="handleAddButton(item.buttonList)"
146
+ >
103
147
  <icon-plus />
104
148
  <span class="btn-text">添加按钮</span>
105
149
  </div>
106
150
 
107
151
  <p class="item-title">链接</p>
108
152
  <draggable
109
- v-model="item.data.linkList"
153
+ v-model="item.linkList"
110
154
  :component-data="{
111
155
  tag: 'div',
112
156
  type: 'transition-group',
113
- name: !drag ? 'flip-list' : null
157
+ name: !drag ? 'flip-list' : null,
114
158
  }"
115
159
  v-bind="linkDragOptions"
116
- :disabled="!shouldShowDragHandle(item.data.linkList)"
160
+ :disabled="!shouldShowDragHandle(item.linkList)"
117
161
  @start="drag = true"
118
162
  @end="drag = false"
119
163
  item-key="id"
@@ -121,29 +165,50 @@
121
165
  <template #item="{ element: link }">
122
166
  <div
123
167
  class="item-button draggable-item"
124
- :class="{ 'sortable-disabled': !shouldShowDragHandle(item.data.linkList) }"
168
+ :class="{
169
+ 'sortable-disabled': !shouldShowDragHandle(
170
+ item.linkList
171
+ ),
172
+ }"
125
173
  :key="link.id"
126
174
  >
127
175
  <div class="btn-group">
128
176
  <div
129
- v-if="shouldShowDragHandle(item.data.linkList)"
177
+ v-if="shouldShowDragHandle(item.linkList)"
130
178
  class="drag-handle"
131
179
  >
132
180
  <icon-drag-arrow class="drag-icon" />
133
181
  </div>
134
- <icon-delete class="btn-delete" @click="handleDeleteLink(item.data.linkList, link.id)" />
182
+ <icon-delete
183
+ class="btn-delete"
184
+ @click="handleDeleteLink(item.linkList, link.id)"
185
+ />
135
186
  </div>
136
-
187
+
137
188
  <a-link href="link">{{ link.text }}</a-link>
138
189
  <div class="item-action flex items-center">
139
- <a-input class="action-text" v-model="link.text" placeholder="按钮文本" allow-clear />
140
- <a-input v-model="link.url" placeholder="按钮链接" allow-clear />
190
+ <a-input
191
+ class="action-text"
192
+ v-model="link.text"
193
+ placeholder="按钮文本"
194
+ allow-clear
195
+ />
196
+ <a-input
197
+ v-model="link.url"
198
+ placeholder="按钮链接"
199
+ allow-clear
200
+ />
141
201
  </div>
142
- <a-checkbox :model-value="link.isExternal">是否外部链接</a-checkbox>
202
+ <a-checkbox :model-value="link.isExternal"
203
+ >是否外部链接</a-checkbox
204
+ >
143
205
  </div>
144
206
  </template>
145
207
  </draggable>
146
- <div class="item-add-btn flex items-center" @click="handleAddLink(item.data.linkList)">
208
+ <div
209
+ class="item-add-btn flex items-center"
210
+ @click="handleAddLink(item.linkList)"
211
+ >
147
212
  <icon-plus />
148
213
  <span class="btn-text">添加链接</span>
149
214
  </div>
@@ -151,21 +216,25 @@
151
216
 
152
217
  <template v-if="item.type === 'Contact'">
153
218
  <p class="item-title">标题</p>
154
- <a-input v-model="item.data.title" placeholder="请输入标题" allow-clear />
219
+ <a-input
220
+ v-model="item.title"
221
+ placeholder="请输入标题"
222
+ allow-clear
223
+ />
155
224
 
156
225
  <p class="item-title">内容</p>
157
- <RichTextEditor v-model="item.data.content"></RichTextEditor>
226
+ <RichTextEditor v-model="item.content"></RichTextEditor>
158
227
 
159
228
  <p class="item-title">分类</p>
160
229
  <draggable
161
- v-model="item.data.categories"
230
+ v-model="item.categories"
162
231
  :component-data="{
163
232
  tag: 'div',
164
233
  type: 'transition-group',
165
- name: !drag ? 'flip-list' : null
234
+ name: !drag ? 'flip-list' : null,
166
235
  }"
167
236
  v-bind="categoryDragOptions"
168
- :disabled="!shouldShowDragHandle(item.data.categories)"
237
+ :disabled="!shouldShowDragHandle(item.categories)"
169
238
  @start="drag = true"
170
239
  @end="drag = false"
171
240
  item-key="id"
@@ -173,41 +242,62 @@
173
242
  <template #item="{ element: category }">
174
243
  <div
175
244
  class="item-button draggable-item"
176
- :class="{ 'sortable-disabled': !shouldShowDragHandle(item.data.categories) }"
245
+ :class="{
246
+ 'sortable-disabled': !shouldShowDragHandle(
247
+ item.categories
248
+ ),
249
+ }"
177
250
  :key="category.id"
178
251
  >
179
252
  <div class="btn-group">
180
253
  <div
181
- v-if="shouldShowDragHandle(item.data.categories)"
254
+ v-if="shouldShowDragHandle(item.categories)"
182
255
  class="drag-handle"
183
256
  >
184
257
  <icon-drag-arrow class="drag-icon" />
185
258
  </div>
186
- <icon-delete class="btn-delete" @click="handleDeleteCategory(item.data.categories, category.id)" />
259
+ <icon-delete
260
+ class="btn-delete"
261
+ @click="
262
+ handleDeleteCategory(item.categories, category.id)
263
+ "
264
+ />
187
265
  </div>
188
- <icon-delete class="btn-delete" @click="handleDeleteCategory(item.data.categories, category.id)" />
266
+ <icon-delete
267
+ class="btn-delete"
268
+ @click="
269
+ handleDeleteCategory(item.categories, category.id)
270
+ "
271
+ />
189
272
  <a-link href="link">{{ category.text }}</a-link>
190
273
  <div class="item-action flex items-center">
191
- <a-input v-model="category.text" placeholder="分类名称" allow-clear />
274
+ <a-input
275
+ v-model="category.text"
276
+ placeholder="分类名称"
277
+ allow-clear
278
+ />
192
279
  </div>
193
280
  </div>
194
281
  </template>
195
282
  </draggable>
196
- <div class="item-add-btn flex items-center" @click="handleAddCategory(item.data.categories)">
283
+ <div
284
+ class="item-add-btn flex items-center"
285
+ @click="handleAddCategory(item.categories)"
286
+ >
197
287
  <icon-plus />
198
288
  <span class="btn-text">添加分类</span>
199
289
  </div>
200
290
 
201
291
  <p class="item-title">链接</p>
202
292
  <draggable
203
- v-model="item.data.linkList"
293
+ v-model="item.linkList"
204
294
  :component-data="{
205
295
  tag: 'div',
206
296
  type: 'transition-group',
207
- name: !drag ? 'flip-list' : null
297
+ name: !drag ? 'flip-list' : null,
208
298
  }"
209
299
  v-bind="linkDragOptions"
210
- :disabled="!shouldShowDragHandle(item.data.linkList)"
300
+ :disabled="!shouldShowDragHandle(item.linkList)"
211
301
  @start="drag = true"
212
302
  @end="drag = false"
213
303
  item-key="id"
@@ -215,56 +305,97 @@
215
305
  <template #item="{ element: link }">
216
306
  <div
217
307
  class="item-button draggable-item"
218
- :class="{ 'sortable-disabled': !shouldShowDragHandle(item.data.linkList) }"
308
+ :class="{
309
+ 'sortable-disabled': !shouldShowDragHandle(
310
+ item.linkList
311
+ ),
312
+ }"
219
313
  :key="link.id"
220
314
  >
221
315
  <div class="btn-group">
222
316
  <div
223
- v-if="shouldShowDragHandle(item.data.linkList)"
317
+ v-if="shouldShowDragHandle(item.linkList)"
224
318
  class="drag-handle"
225
319
  >
226
320
  <icon-drag-arrow class="drag-icon" />
227
321
  </div>
228
- <icon-delete class="btn-delete" @click="handleDeleteLink(item.data.linkList, link.id)" />
322
+ <icon-delete
323
+ class="btn-delete"
324
+ @click="handleDeleteLink(item.linkList, link.id)"
325
+ />
229
326
  </div>
230
327
  <a-link href="link">{{ link.text }}</a-link>
231
328
  <div class="item-action flex items-center">
232
- <a-input class="action-text" v-model="link.text" placeholder="按钮文本" allow-clear />
233
- <a-input v-model="link.url" placeholder="按钮链接" allow-clear />
329
+ <a-input
330
+ class="action-text"
331
+ v-model="link.text"
332
+ placeholder="按钮文本"
333
+ allow-clear
334
+ />
335
+ <a-input
336
+ v-model="link.url"
337
+ placeholder="按钮链接"
338
+ allow-clear
339
+ />
234
340
  </div>
235
- <a-checkbox :model-value="link.isExternal">是否外部链接</a-checkbox>
341
+ <a-checkbox :model-value="link.isExternal"
342
+ >是否外部链接</a-checkbox
343
+ >
236
344
  </div>
237
345
  </template>
238
346
  </draggable>
239
- <div class="item-add-btn flex items-center" @click="handleAddLink(item.data.linkList)">
347
+ <div
348
+ class="item-add-btn flex items-center"
349
+ @click="handleAddLink(item.linkList)"
350
+ >
240
351
  <icon-plus />
241
352
  <span class="btn-text">添加链接</span>
242
353
  </div>
243
354
  </template>
244
355
 
245
356
  <template v-if="item.type === 'Image'">
246
- <img class="item-img" :src="item.data.imgSrc" />
357
+ <img class="item-img" :src="item.imgSrc" />
247
358
  <div class="item-uplaod flex items-center">
248
- <a-input v-model="item.data.imgSrc" placeholder="请输入标题" allow-clear />
249
- <a-upload class="fit-content" :show-file-list="false" action="/" />
359
+ <a-input
360
+ v-model="item.imgSrc"
361
+ placeholder="请输入标题"
362
+ allow-clear
363
+ />
364
+ <a-upload
365
+ class="fit-content"
366
+ :show-file-list="false"
367
+ action="/"
368
+ />
250
369
  </div>
251
- <a-input class="mt-10" v-model="item.data.caption" placeholder="图片描述" allow-clear />
252
- <a-input class="mt-10" v-model="item.data.alt" placeholder="图片alt" allow-clear />
253
- <a-checkbox class="pt-10" :model-value="item.data.isRound">圆角</a-checkbox>
370
+ <a-input
371
+ class="mt-2"
372
+ v-model="item.caption"
373
+ placeholder="图片描述"
374
+ allow-clear
375
+ />
376
+ <a-input
377
+ class="mt-2"
378
+ v-model="item.alt"
379
+ placeholder="图片alt"
380
+ allow-clear
381
+ />
382
+ <a-checkbox class="pt-2" :model-value="item.isRound"
383
+ >圆角</a-checkbox
384
+ >
254
385
  </template>
255
386
 
256
387
  <template v-if="item.type === 'ImageList'">
257
388
  <p class="item-title">图片组</p>
258
389
  <div class="item-img-list">
259
390
  <draggable
260
- v-model="item.data.imageList"
391
+ v-model="item.imageList"
261
392
  :component-data="{
262
393
  tag: 'div',
263
394
  type: 'transition-group',
264
- name: !drag ? 'flip-list' : null
395
+ name: !drag ? 'flip-list' : null,
265
396
  }"
266
397
  v-bind="imageDragOptions"
267
- :disabled="!shouldShowDragHandle(item.data.imageList)"
398
+ :disabled="!shouldShowDragHandle(item.imageList)"
268
399
  @start="drag = true"
269
400
  @end="drag = false"
270
401
  item-key="id"
@@ -272,49 +403,80 @@
272
403
  <template #item="{ element: img }">
273
404
  <div
274
405
  class="img-list-item flex draggable-item"
275
- :class="{ 'sortable-disabled': !shouldShowDragHandle(item.data.imageList) }"
406
+ :class="{
407
+ 'sortable-disabled': !shouldShowDragHandle(
408
+ item.imageList
409
+ ),
410
+ }"
276
411
  :key="img.id"
277
- >
412
+ >
278
413
  <div class="btn-group">
279
414
  <div
280
- v-if="shouldShowDragHandle(item.data.imageList)"
415
+ v-if="shouldShowDragHandle(item.imageList)"
281
416
  class="drag-handle"
282
417
  >
283
418
  <icon-drag-arrow class="drag-icon" />
284
419
  </div>
285
- <icon-delete class="btn-delete" @click="handleDeleteImage(item.data.imageList, img.id)" />
420
+ <icon-delete
421
+ class="btn-delete"
422
+ @click="handleDeleteImage(item.imageList, img.id)"
423
+ />
286
424
  </div>
287
-
425
+
288
426
  <div class="item-img-box" v-if="img.src">
289
- <!-- <icon-close-circle-fill class="item-img-dlete" @click="handleDeleteImage(item.data.imageList, img.id)" /> -->
427
+ <!-- <icon-close-circle-fill class="item-img-dlete" @click="handleDeleteImage(item.imageList, img.id)" /> -->
290
428
  <img class="item-img small-img" :src="img.src" />
291
429
  </div>
292
430
 
293
431
  <div class="item-right flex-1">
294
- <a-input style="margin-bottom: 12px" v-model="img.src" placeholder="请输入图片路径" allow-clear />
432
+ <a-input
433
+ style="margin-bottom: 12px"
434
+ v-model="img.src"
435
+ placeholder="请输入图片路径"
436
+ allow-clear
437
+ />
295
438
  <a-upload :show-file-list="false" action="/" />
296
439
  </div>
297
440
  </div>
298
441
  </template>
299
442
  </draggable>
300
443
  </div>
301
- <div class="item-add-btn flex items-center" @click="handleAddImage(item.data.imageList)">
444
+ <div
445
+ class="item-add-btn flex items-center"
446
+ @click="handleAddImage(item.imageList)"
447
+ >
302
448
  <icon-plus />
303
449
  <span class="btn-text">添加图片</span>
304
- </div>
450
+ </div>
305
451
  </template>
306
452
 
307
453
  <template v-if="item.type === 'Video'">
308
454
  <p class="item-title">视频</p>
309
- <video class="item-img" :src="item.data.videoSrc" controls></video>
455
+ <video class="item-img" :src="item.videoSrc" controls></video>
310
456
  <div class="item-uplaod flex items-center">
311
- <a-input v-model="item.data.videoSrc" placeholder="请输入视频链接" allow-clear />
312
- <a-upload class="fit-content" :show-file-list="false" action="/" />
457
+ <a-input
458
+ v-model="item.videoSrc"
459
+ placeholder="请输入视频链接"
460
+ allow-clear
461
+ />
462
+ <a-upload
463
+ class="fit-content"
464
+ :show-file-list="false"
465
+ action="/"
466
+ />
313
467
  </div>
314
- <img class="item-img" :src="item.data.imgSrc" />
468
+ <img class="item-img" :src="item.imgSrc" />
315
469
  <div class="item-uplaod flex items-center">
316
- <a-input v-model="item.data.imgSrc" placeholder="视频封面" allow-clear />
317
- <a-upload class="fit-content" :show-file-list="false" action="/" />
470
+ <a-input
471
+ v-model="item.imgSrc"
472
+ placeholder="视频封面"
473
+ allow-clear
474
+ />
475
+ <a-upload
476
+ class="fit-content"
477
+ :show-file-list="false"
478
+ action="/"
479
+ />
318
480
  </div>
319
481
  </template>
320
482
  </div>
@@ -326,178 +488,180 @@
326
488
  </template>
327
489
 
328
490
  <script lang="ts" setup>
329
- import { ref, computed } from 'vue'
330
- import draggable from 'vuedraggable'
331
- import RichTextEditor from '@/components/RichTextEditor'
332
- import { randomString } from '@/utils/common'
491
+ import { ref, computed } from "vue";
492
+ import draggable from "vuedraggable";
493
+ import RichTextEditor from "@/components/RichTextEditor";
494
+ import { randomString } from "@/utils/common";
333
495
 
334
496
  // 拖拽相关状态
335
- const drag = ref(false)
497
+ const drag = ref(false);
336
498
 
337
499
  // 不同类型的拖拽配置选项
338
500
  const dragOptions = computed(() => ({
339
501
  animation: 200,
340
- group: 'item', // 按钮专用分组
502
+ group: "item",
341
503
  disabled: false,
342
- ghostClass: 'ghost'
343
- }))
504
+ ghostClass: "ghost",
505
+ }));
344
506
 
345
507
  const buttonDragOptions = computed(() => ({
346
508
  animation: 200,
347
- group: 'buttons', // 按钮专用分组
509
+ group: "buttons", // 按钮专用分组
348
510
  disabled: false,
349
- ghostClass: 'ghost'
350
- }))
511
+ ghostClass: "ghost",
512
+ }));
351
513
 
352
514
  const linkDragOptions = computed(() => ({
353
515
  animation: 200,
354
- group: 'links', // 链接专用分组
516
+ group: "links", // 链接专用分组
355
517
  disabled: false,
356
- ghostClass: 'ghost'
357
- }))
518
+ ghostClass: "ghost",
519
+ }));
358
520
 
359
521
  const categoryDragOptions = computed(() => ({
360
522
  animation: 200,
361
- group: 'categories', // 分类专用分组
523
+ group: "categories", // 分类专用分组
362
524
  disabled: false,
363
- ghostClass: 'ghost'
364
- }))
525
+ ghostClass: "ghost",
526
+ }));
365
527
 
366
528
  const imageDragOptions = computed(() => ({
367
529
  animation: 200,
368
- group: 'images', // 图片专用分组
530
+ group: "images", // 图片专用分组
369
531
  disabled: false,
370
- ghostClass: 'ghost'
371
- }))
532
+ ghostClass: "ghost",
533
+ }));
372
534
 
373
535
  // 检查是否应该显示拖拽图标
374
536
  const shouldShowDragHandle = (list: any[]) => {
375
- return list && list.length > 1
376
- }
537
+ return list && list.length > 1;
538
+ };
377
539
 
378
540
  const props = defineProps({
379
541
  show: {
380
542
  type: Boolean,
381
- default: false
543
+ default: false,
382
544
  },
383
545
 
384
546
  data: {
385
547
  type: Object,
386
- default: () => {}
387
- }
388
- })
548
+ default: () => {},
549
+ },
550
+ });
389
551
 
390
- const emit = defineEmits(['update:show']);
552
+ const emit = defineEmits(["update:show"]);
391
553
 
392
554
  const handleCancel = () => {
393
- emit('update:show', false);
394
- }
555
+ emit("update:show", false);
556
+ };
395
557
 
396
558
  const handleAdd = (type: string) => {
397
559
  const detail = props.data;
398
- if (type === 'Article') {
560
+ if (type === "Article") {
399
561
  detail.data.push({
400
562
  id: randomString(),
401
- type: 'Article',
402
- data: {
403
- title: '',
404
- content: '',
405
- buttonList: [],
406
- linkList: []
407
- }
408
- })
409
- } else if (type === 'Contact') {
563
+ type: "Article",
564
+ title: "",
565
+ content: "",
566
+ buttonList: [],
567
+ linkList: [],
568
+ });
569
+ } else if (type === "Contact") {
410
570
  detail.data.push({
411
571
  id: randomString(),
412
- type: 'Contact',
413
- data: {
414
- title: '',
415
- content: '',
416
- categories: [],
417
- linkList: []
418
- }
419
- })
420
- } else if (type === 'Image') {
572
+ type: "Contact",
573
+ title: "",
574
+ content: "",
575
+ categories: [],
576
+ linkList: [],
577
+ });
578
+ } else if (type === "Image") {
421
579
  detail.data.push({
422
580
  id: randomString(),
423
- type: 'Image',
424
- data: {
425
- imgSrc: '',
426
- caption: '',
427
- alt: '',
428
- isRound: false
429
- }
430
- })
431
- } else if (type === 'ImageList') {
581
+ type: "Image",
582
+ imgSrc: "",
583
+ caption: "",
584
+ alt: "",
585
+ isRound: false,
586
+ });
587
+ } else if (type === "ImageList") {
432
588
  detail.data.push({
433
589
  id: randomString(),
434
- type: 'ImageList',
435
- data: {
436
- imageList: []
437
- }
438
- })
439
- } else if (type === 'Video') {
590
+ type: "ImageList",
591
+ imageList: [],
592
+ });
593
+ } else if (type === "Video") {
440
594
  detail.data.push({
441
595
  id: randomString(),
442
- type: 'Video',
443
- data: {
444
- videoSrc: '',
445
- imgSrc: ''
446
- }
447
- })
596
+ type: "Video",
597
+ videoSrc: "",
598
+ imgSrc: "",
599
+ });
448
600
  }
449
- }
601
+ };
450
602
 
451
603
  const handleDelete = (id: string) => {
452
- props.data.data = props.data.data.filter((item: any) => item.id !== id)
453
- }
604
+ props.data.data = props.data.data.filter((item: any) => item.id !== id);
605
+ };
454
606
 
455
607
  const handleAddButton = (list: any[]) => {
456
608
  list.push({
457
609
  id: randomString(),
458
- text: '查看更多',
610
+ text: "查看更多",
459
611
  url: undefined,
460
- isExternal: false
461
- })
462
- }
612
+ isExternal: false,
613
+ });
614
+ };
463
615
 
464
616
  const handleDeleteButton = (list: any[], id: string) => {
465
- list.splice(list.findIndex(item => item.id === id), 1)
466
- }
617
+ list.splice(
618
+ list.findIndex((item) => item.id === id),
619
+ 1
620
+ );
621
+ };
467
622
 
468
623
  const handleAddLink = (list: any[]) => {
469
624
  list.push({
470
625
  id: randomString(),
471
- text: '查看更多',
626
+ text: "查看更多",
472
627
  url: undefined,
473
- isExternal: false
474
- })
475
- }
628
+ isExternal: false,
629
+ });
630
+ };
476
631
 
477
632
  const handleDeleteLink = (list: any[], id: string) => {
478
- list.splice(list.findIndex(item => item.id === id), 1)
479
- }
633
+ list.splice(
634
+ list.findIndex((item) => item.id === id),
635
+ 1
636
+ );
637
+ };
480
638
 
481
639
  const handleAddCategory = (list: any[]) => {
482
640
  list.push({
483
641
  id: randomString(),
484
- text: '分类'
485
- })
486
- }
642
+ text: "分类",
643
+ });
644
+ };
487
645
 
488
646
  const handleDeleteCategory = (list: any[], id: string) => {
489
- list.splice(list.findIndex(item => item.id === id), 1)
490
- }
647
+ list.splice(
648
+ list.findIndex((item) => item.id === id),
649
+ 1
650
+ );
651
+ };
491
652
  const handleAddImage = (list: any[]) => {
492
653
  list.push({
493
654
  id: randomString(),
494
- src: ''
495
- })
496
- }
655
+ src: "",
656
+ });
657
+ };
497
658
 
498
659
  const handleDeleteImage = (list: any[], img: string) => {
499
- list.splice(list.findIndex(item => item === img), 1)
500
- }
660
+ list.splice(
661
+ list.findIndex((item) => item === img),
662
+ 1
663
+ );
664
+ };
501
665
  </script>
502
666
 
503
667
  <style lang="scss" scoped>
@@ -514,7 +678,7 @@ const handleDeleteImage = (list: any[], img: string) => {
514
678
 
515
679
  .setting-body {
516
680
  margin-top: 12px;
517
-
681
+
518
682
  .setting-item {
519
683
  position: relative;
520
684
  padding: 16px 12px;
@@ -730,4 +894,4 @@ const handleDeleteImage = (list: any[], img: string) => {
730
894
  }
731
895
  }
732
896
  }
733
- </style>
897
+ </style>