@hbixinlian/as-editor-components 1.0.0 → 1.0.1
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/README.md +387 -387
- package/dist/as-editor-components.css +1 -1
- package/dist/as-editor-components.es.js +2733 -3657
- package/dist/as-editor-components.es.js.map +1 -1
- package/dist/as-editor-components.umd.js +1 -45
- package/dist/as-editor-components.umd.js.map +1 -1
- package/dist/config/config.js +4 -4
- package/dist/index.html +21 -21
- package/dist/langs/zh_CN.js +415 -415
- package/dist/types/index.d.ts +26 -219
- package/package.json +107 -106
package/README.md
CHANGED
|
@@ -1,388 +1,388 @@
|
|
|
1
|
-
# @hbixinlian/as-editor-components
|
|
2
|
-
|
|
3
|
-
AS-Editor 可视化拖拽编辑器组件库 - 基于Vue3的可复用UI组件集合
|
|
4
|
-
|
|
5
|
-
## 📦 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @hbixinlian/as-editor-components
|
|
9
|
-
# 或
|
|
10
|
-
pnpm install @hbixinlian/as-editor-components
|
|
11
|
-
# 或
|
|
12
|
-
yarn add @hbixinlian/as-editor-components
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 🚀 快速开始
|
|
16
|
-
|
|
17
|
-
### 完整引入
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
import { createApp } from 'vue'
|
|
21
|
-
import AsEditorComponents from '@hbixinlian/as-editor-components'
|
|
22
|
-
import '@hbixinlian/as-editor-components/dist/as-editor-components.css'
|
|
23
|
-
|
|
24
|
-
const app = createApp(App)
|
|
25
|
-
app.use(AsEditorComponents)
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### 按需引入
|
|
29
|
-
|
|
30
|
-
```javascript
|
|
31
|
-
import { ComponentRenderer, CaptionText, PictureAds } from '@hbixinlian/as-editor-components'
|
|
32
|
-
|
|
33
|
-
// 在组件中使用
|
|
34
|
-
export default {
|
|
35
|
-
components: {
|
|
36
|
-
ComponentRenderer,
|
|
37
|
-
CaptionText,
|
|
38
|
-
PictureAds
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 分类引入
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
import {
|
|
47
|
-
BasicComponents, // 基础组件
|
|
48
|
-
BusinessComponents, // 业务组件
|
|
49
|
-
LayoutComponents, // 布局组件
|
|
50
|
-
MediaComponents // 媒体组件
|
|
51
|
-
} from '@hbixinlian/as-editor-components'
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## 📋 组件列表
|
|
55
|
-
|
|
56
|
-
### 核心组件
|
|
57
|
-
|
|
58
|
-
#### ComponentRenderer - 组件渲染器
|
|
59
|
-
核心渲染组件,用于渲染页面配置和组件列表。
|
|
60
|
-
|
|
61
|
-
```vue
|
|
62
|
-
<template>
|
|
63
|
-
<ComponentRenderer
|
|
64
|
-
:pageConfig="pageConfig"
|
|
65
|
-
:components="components"
|
|
66
|
-
:minHeight="600"
|
|
67
|
-
:showEditControls="false"
|
|
68
|
-
:enableInteraction="true"
|
|
69
|
-
@component-click="handleComponentClick"
|
|
70
|
-
@component-delete="handleComponentDelete"
|
|
71
|
-
@renderer-ready="handleRendererReady"
|
|
72
|
-
/>
|
|
73
|
-
</template>
|
|
74
|
-
|
|
75
|
-
<script setup>
|
|
76
|
-
import { ComponentRenderer } from '@hbixinlian/as-editor-components'
|
|
77
|
-
|
|
78
|
-
const pageConfig = {
|
|
79
|
-
name: '页面标题',
|
|
80
|
-
isPerson: false,
|
|
81
|
-
isBack: true,
|
|
82
|
-
titleHeight: 35,
|
|
83
|
-
bgColor: '#f9f9f9',
|
|
84
|
-
bgImg: ''
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const components = [
|
|
88
|
-
{
|
|
89
|
-
component: 'CaptionText',
|
|
90
|
-
setStyle: {
|
|
91
|
-
name: '标题文本',
|
|
92
|
-
wordSize: 16,
|
|
93
|
-
wordColor: '#333'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
const handleComponentClick = ({ component, index }) => {
|
|
99
|
-
console.log('组件点击:', component, index)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const handleComponentDelete = ({ index }) => {
|
|
103
|
-
console.log('删除组件:', index)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const handleRendererReady = () => {
|
|
107
|
-
console.log('渲染器准备完成')
|
|
108
|
-
}
|
|
109
|
-
</script>
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### 基础组件
|
|
113
|
-
|
|
114
|
-
#### CaptionText - 标题文本组件
|
|
115
|
-
用于显示标题和描述文本。
|
|
116
|
-
|
|
117
|
-
```vue
|
|
118
|
-
<CaptionText :datas="{
|
|
119
|
-
name: '标题文本',
|
|
120
|
-
description: '描述文本',
|
|
121
|
-
wordSize: 16,
|
|
122
|
-
wordColor: '#333',
|
|
123
|
-
positions: 'left',
|
|
124
|
-
backColor: '#fff'
|
|
125
|
-
}" />
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
#### PictureAds - 图片广告组件
|
|
129
|
-
支持单图、轮播等多种展示模式。
|
|
130
|
-
|
|
131
|
-
```vue
|
|
132
|
-
<PictureAds :datas="{
|
|
133
|
-
imageList: [
|
|
134
|
-
{ src: 'image1.jpg', text: '图片1' },
|
|
135
|
-
{ src: 'image2.jpg', text: '图片2' }
|
|
136
|
-
],
|
|
137
|
-
swiperType: 1,
|
|
138
|
-
borderRadius: 8
|
|
139
|
-
}" />
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
#### RichText - 富文本组件
|
|
143
|
-
支持富文本内容展示。
|
|
144
|
-
|
|
145
|
-
```vue
|
|
146
|
-
<RichText :datas="{
|
|
147
|
-
content: '<p>富文本内容</p>',
|
|
148
|
-
padding: 16
|
|
149
|
-
}" />
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
#### Notice - 通知栏组件
|
|
153
|
-
用于展示通知消息。
|
|
154
|
-
|
|
155
|
-
```vue
|
|
156
|
-
<Notice :datas="{
|
|
157
|
-
text: '通知内容',
|
|
158
|
-
speed: 50,
|
|
159
|
-
color: '#333',
|
|
160
|
-
backgroundColor: '#fff'
|
|
161
|
-
}" />
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
#### TabBar - 标签栏组件
|
|
165
|
-
用于标签页切换。
|
|
166
|
-
|
|
167
|
-
```vue
|
|
168
|
-
<TabBar :datas="{
|
|
169
|
-
tabs: [
|
|
170
|
-
{ name: '标签1', active: true },
|
|
171
|
-
{ name: '标签2', active: false }
|
|
172
|
-
]
|
|
173
|
-
}" />
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
#### Videos - 视频组件
|
|
177
|
-
用于视频播放展示。
|
|
178
|
-
|
|
179
|
-
```vue
|
|
180
|
-
<Videos :datas="{
|
|
181
|
-
src: 'video.mp4',
|
|
182
|
-
poster: 'poster.jpg',
|
|
183
|
-
autoplay: false
|
|
184
|
-
}" />
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### 业务组件
|
|
188
|
-
|
|
189
|
-
#### CommoditySearch - 商品搜索组件
|
|
190
|
-
```vue
|
|
191
|
-
<CommoditySearch :datas="{ placeholder: '请输入搜索关键词' }" />
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
#### CommunityPowder - 社群运营组件
|
|
195
|
-
```vue
|
|
196
|
-
<CommunityPowder :datas="{ title: '社群标题', memberCount: 1000 }" />
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
#### PersonalizedRecommendation - 个性化推荐组件
|
|
200
|
-
```vue
|
|
201
|
-
<PersonalizedRecommendation :datas="{
|
|
202
|
-
title: '为您推荐',
|
|
203
|
-
products: []
|
|
204
|
-
}" />
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### 布局组件
|
|
208
|
-
|
|
209
|
-
#### AuxiliarySegmentation - 辅助分割线组件
|
|
210
|
-
```vue
|
|
211
|
-
<AuxiliarySegmentation :datas="{
|
|
212
|
-
height: 10,
|
|
213
|
-
backgroundColor: '#f5f5f5'
|
|
214
|
-
}" />
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
#### MagicCube - 魔方组件
|
|
218
|
-
```vue
|
|
219
|
-
<MagicCube :datas="{
|
|
220
|
-
items: [
|
|
221
|
-
{ icon: 'icon1', text: '选项1' },
|
|
222
|
-
{ icon: 'icon2', text: '选项2' }
|
|
223
|
-
]
|
|
224
|
-
}" />
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### 媒体组件
|
|
228
|
-
|
|
229
|
-
#### CourseModule - 课程模块组件
|
|
230
|
-
```vue
|
|
231
|
-
<CourseModule :datas="{
|
|
232
|
-
courseList: [],
|
|
233
|
-
title: '推荐课程'
|
|
234
|
-
}" />
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
#### LiveModule - 直播模块组件
|
|
238
|
-
```vue
|
|
239
|
-
<LiveModule :datas="{
|
|
240
|
-
liveList: [],
|
|
241
|
-
title: '直播间'
|
|
242
|
-
}" />
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## 🛠 工具和配置
|
|
246
|
-
|
|
247
|
-
### ComponentProperties
|
|
248
|
-
组件属性配置数据,包含所有组件的默认配置和属性定义。
|
|
249
|
-
|
|
250
|
-
```javascript
|
|
251
|
-
import { Utils } from '@hbixinlian/as-editor-components'
|
|
252
|
-
const { ComponentProperties } = Utils
|
|
253
|
-
|
|
254
|
-
// 获取组件配置
|
|
255
|
-
const captionTextConfig = ComponentProperties.find(item => item.name === 'captiontext')
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### ComponentFactory
|
|
259
|
-
组件工厂,用于动态创建和管理组件。
|
|
260
|
-
|
|
261
|
-
```javascript
|
|
262
|
-
import { Utils } from '@hbixinlian/as-editor-components'
|
|
263
|
-
const { ComponentFactory } = Utils
|
|
264
|
-
|
|
265
|
-
// 使用组件工厂
|
|
266
|
-
const componentInstance = ComponentFactory.createComponent('captiontext', config)
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## 📝 TypeScript 支持
|
|
270
|
-
|
|
271
|
-
本组件库提供完整的TypeScript类型定义:
|
|
272
|
-
|
|
273
|
-
```typescript
|
|
274
|
-
import { ComponentRendererProps, ComponentItem, PageConfig } from '@hbixinlian/as-editor-components'
|
|
275
|
-
|
|
276
|
-
const pageConfig: PageConfig = {
|
|
277
|
-
name: '页面标题',
|
|
278
|
-
bgColor: '#f9f9f9'
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
const components: ComponentItem[] = [
|
|
282
|
-
{
|
|
283
|
-
component: 'CaptionText',
|
|
284
|
-
setStyle: {
|
|
285
|
-
name: '标题'
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
]
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## 🎯 依赖要求
|
|
292
|
-
|
|
293
|
-
### Peer Dependencies
|
|
294
|
-
- Vue 3.x
|
|
295
|
-
- Vant 3.x (UI组件库)
|
|
296
|
-
- Element Plus 1.x (部分组件使用)
|
|
297
|
-
|
|
298
|
-
请确保在项目中安装这些依赖:
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
npm install vue@^3.0.0 vant@^3.0.0 element-plus@^1.0.0
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## 📖 完整示例
|
|
305
|
-
|
|
306
|
-
```vue
|
|
307
|
-
<template>
|
|
308
|
-
<div class="app">
|
|
309
|
-
<ComponentRenderer
|
|
310
|
-
:pageConfig="pageConfig"
|
|
311
|
-
:components="components"
|
|
312
|
-
:minHeight="600"
|
|
313
|
-
@component-click="handleClick"
|
|
314
|
-
/>
|
|
315
|
-
</div>
|
|
316
|
-
</template>
|
|
317
|
-
|
|
318
|
-
<script setup>
|
|
319
|
-
import { ref } from 'vue'
|
|
320
|
-
import { ComponentRenderer } from '@hbixinlian/as-editor-components'
|
|
321
|
-
import '@hbixinlian/as-editor-components/dist/as-editor-components.css'
|
|
322
|
-
|
|
323
|
-
const pageConfig = ref({
|
|
324
|
-
name: '商城首页',
|
|
325
|
-
bgColor: '#f9f9f9'
|
|
326
|
-
})
|
|
327
|
-
|
|
328
|
-
const components = ref([
|
|
329
|
-
{
|
|
330
|
-
component: 'CaptionText',
|
|
331
|
-
setStyle: {
|
|
332
|
-
name: '热门推荐',
|
|
333
|
-
wordSize: 18,
|
|
334
|
-
wordColor: '#333',
|
|
335
|
-
positions: 'center'
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
component: 'PictureAds',
|
|
340
|
-
setStyle: {
|
|
341
|
-
imageList: [
|
|
342
|
-
{ src: 'banner1.jpg', text: '广告1' },
|
|
343
|
-
{ src: 'banner2.jpg', text: '广告2' }
|
|
344
|
-
],
|
|
345
|
-
swiperType: 1,
|
|
346
|
-
borderRadius: 8
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
])
|
|
350
|
-
|
|
351
|
-
const handleClick = ({ component, index }) => {
|
|
352
|
-
console.log('点击了组件:', component.component, '索引:', index)
|
|
353
|
-
}
|
|
354
|
-
</script>
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
## 🔧 开发与构建
|
|
358
|
-
|
|
359
|
-
```bash
|
|
360
|
-
# 安装依赖
|
|
361
|
-
npm install
|
|
362
|
-
|
|
363
|
-
# 开发模式
|
|
364
|
-
npm run dev
|
|
365
|
-
|
|
366
|
-
# 构建库
|
|
367
|
-
npm run build:lib
|
|
368
|
-
|
|
369
|
-
# 代码检查
|
|
370
|
-
npm run lint
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
## 📄 许可证
|
|
374
|
-
|
|
375
|
-
MIT License
|
|
376
|
-
|
|
377
|
-
## 🤝 贡献
|
|
378
|
-
|
|
379
|
-
欢迎提交 Issues 和 Pull Requests!
|
|
380
|
-
|
|
381
|
-
## 📞 联系
|
|
382
|
-
|
|
383
|
-
- 作者: 孤傲 <9068149@qq.com>
|
|
384
|
-
- GitHub: https://github.com/hbixinlian/as-editor
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
1
|
+
# @hbixinlian/as-editor-components
|
|
2
|
+
|
|
3
|
+
AS-Editor 可视化拖拽编辑器组件库 - 基于Vue3的可复用UI组件集合
|
|
4
|
+
|
|
5
|
+
## 📦 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hbixinlian/as-editor-components
|
|
9
|
+
# 或
|
|
10
|
+
pnpm install @hbixinlian/as-editor-components
|
|
11
|
+
# 或
|
|
12
|
+
yarn add @hbixinlian/as-editor-components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 🚀 快速开始
|
|
16
|
+
|
|
17
|
+
### 完整引入
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { createApp } from 'vue'
|
|
21
|
+
import AsEditorComponents from '@hbixinlian/as-editor-components'
|
|
22
|
+
import '@hbixinlian/as-editor-components/dist/as-editor-components.css'
|
|
23
|
+
|
|
24
|
+
const app = createApp(App)
|
|
25
|
+
app.use(AsEditorComponents)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 按需引入
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { ComponentRenderer, CaptionText, PictureAds } from '@hbixinlian/as-editor-components'
|
|
32
|
+
|
|
33
|
+
// 在组件中使用
|
|
34
|
+
export default {
|
|
35
|
+
components: {
|
|
36
|
+
ComponentRenderer,
|
|
37
|
+
CaptionText,
|
|
38
|
+
PictureAds
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 分类引入
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
import {
|
|
47
|
+
BasicComponents, // 基础组件
|
|
48
|
+
BusinessComponents, // 业务组件
|
|
49
|
+
LayoutComponents, // 布局组件
|
|
50
|
+
MediaComponents // 媒体组件
|
|
51
|
+
} from '@hbixinlian/as-editor-components'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 📋 组件列表
|
|
55
|
+
|
|
56
|
+
### 核心组件
|
|
57
|
+
|
|
58
|
+
#### ComponentRenderer - 组件渲染器
|
|
59
|
+
核心渲染组件,用于渲染页面配置和组件列表。
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<template>
|
|
63
|
+
<ComponentRenderer
|
|
64
|
+
:pageConfig="pageConfig"
|
|
65
|
+
:components="components"
|
|
66
|
+
:minHeight="600"
|
|
67
|
+
:showEditControls="false"
|
|
68
|
+
:enableInteraction="true"
|
|
69
|
+
@component-click="handleComponentClick"
|
|
70
|
+
@component-delete="handleComponentDelete"
|
|
71
|
+
@renderer-ready="handleRendererReady"
|
|
72
|
+
/>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script setup>
|
|
76
|
+
import { ComponentRenderer } from '@hbixinlian/as-editor-components'
|
|
77
|
+
|
|
78
|
+
const pageConfig = {
|
|
79
|
+
name: '页面标题',
|
|
80
|
+
isPerson: false,
|
|
81
|
+
isBack: true,
|
|
82
|
+
titleHeight: 35,
|
|
83
|
+
bgColor: '#f9f9f9',
|
|
84
|
+
bgImg: ''
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const components = [
|
|
88
|
+
{
|
|
89
|
+
component: 'CaptionText',
|
|
90
|
+
setStyle: {
|
|
91
|
+
name: '标题文本',
|
|
92
|
+
wordSize: 16,
|
|
93
|
+
wordColor: '#333'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
const handleComponentClick = ({ component, index }) => {
|
|
99
|
+
console.log('组件点击:', component, index)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const handleComponentDelete = ({ index }) => {
|
|
103
|
+
console.log('删除组件:', index)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const handleRendererReady = () => {
|
|
107
|
+
console.log('渲染器准备完成')
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 基础组件
|
|
113
|
+
|
|
114
|
+
#### CaptionText - 标题文本组件
|
|
115
|
+
用于显示标题和描述文本。
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<CaptionText :datas="{
|
|
119
|
+
name: '标题文本',
|
|
120
|
+
description: '描述文本',
|
|
121
|
+
wordSize: 16,
|
|
122
|
+
wordColor: '#333',
|
|
123
|
+
positions: 'left',
|
|
124
|
+
backColor: '#fff'
|
|
125
|
+
}" />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### PictureAds - 图片广告组件
|
|
129
|
+
支持单图、轮播等多种展示模式。
|
|
130
|
+
|
|
131
|
+
```vue
|
|
132
|
+
<PictureAds :datas="{
|
|
133
|
+
imageList: [
|
|
134
|
+
{ src: 'image1.jpg', text: '图片1' },
|
|
135
|
+
{ src: 'image2.jpg', text: '图片2' }
|
|
136
|
+
],
|
|
137
|
+
swiperType: 1,
|
|
138
|
+
borderRadius: 8
|
|
139
|
+
}" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### RichText - 富文本组件
|
|
143
|
+
支持富文本内容展示。
|
|
144
|
+
|
|
145
|
+
```vue
|
|
146
|
+
<RichText :datas="{
|
|
147
|
+
content: '<p>富文本内容</p>',
|
|
148
|
+
padding: 16
|
|
149
|
+
}" />
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Notice - 通知栏组件
|
|
153
|
+
用于展示通知消息。
|
|
154
|
+
|
|
155
|
+
```vue
|
|
156
|
+
<Notice :datas="{
|
|
157
|
+
text: '通知内容',
|
|
158
|
+
speed: 50,
|
|
159
|
+
color: '#333',
|
|
160
|
+
backgroundColor: '#fff'
|
|
161
|
+
}" />
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### TabBar - 标签栏组件
|
|
165
|
+
用于标签页切换。
|
|
166
|
+
|
|
167
|
+
```vue
|
|
168
|
+
<TabBar :datas="{
|
|
169
|
+
tabs: [
|
|
170
|
+
{ name: '标签1', active: true },
|
|
171
|
+
{ name: '标签2', active: false }
|
|
172
|
+
]
|
|
173
|
+
}" />
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### Videos - 视频组件
|
|
177
|
+
用于视频播放展示。
|
|
178
|
+
|
|
179
|
+
```vue
|
|
180
|
+
<Videos :datas="{
|
|
181
|
+
src: 'video.mp4',
|
|
182
|
+
poster: 'poster.jpg',
|
|
183
|
+
autoplay: false
|
|
184
|
+
}" />
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 业务组件
|
|
188
|
+
|
|
189
|
+
#### CommoditySearch - 商品搜索组件
|
|
190
|
+
```vue
|
|
191
|
+
<CommoditySearch :datas="{ placeholder: '请输入搜索关键词' }" />
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### CommunityPowder - 社群运营组件
|
|
195
|
+
```vue
|
|
196
|
+
<CommunityPowder :datas="{ title: '社群标题', memberCount: 1000 }" />
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### PersonalizedRecommendation - 个性化推荐组件
|
|
200
|
+
```vue
|
|
201
|
+
<PersonalizedRecommendation :datas="{
|
|
202
|
+
title: '为您推荐',
|
|
203
|
+
products: []
|
|
204
|
+
}" />
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 布局组件
|
|
208
|
+
|
|
209
|
+
#### AuxiliarySegmentation - 辅助分割线组件
|
|
210
|
+
```vue
|
|
211
|
+
<AuxiliarySegmentation :datas="{
|
|
212
|
+
height: 10,
|
|
213
|
+
backgroundColor: '#f5f5f5'
|
|
214
|
+
}" />
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### MagicCube - 魔方组件
|
|
218
|
+
```vue
|
|
219
|
+
<MagicCube :datas="{
|
|
220
|
+
items: [
|
|
221
|
+
{ icon: 'icon1', text: '选项1' },
|
|
222
|
+
{ icon: 'icon2', text: '选项2' }
|
|
223
|
+
]
|
|
224
|
+
}" />
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 媒体组件
|
|
228
|
+
|
|
229
|
+
#### CourseModule - 课程模块组件
|
|
230
|
+
```vue
|
|
231
|
+
<CourseModule :datas="{
|
|
232
|
+
courseList: [],
|
|
233
|
+
title: '推荐课程'
|
|
234
|
+
}" />
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### LiveModule - 直播模块组件
|
|
238
|
+
```vue
|
|
239
|
+
<LiveModule :datas="{
|
|
240
|
+
liveList: [],
|
|
241
|
+
title: '直播间'
|
|
242
|
+
}" />
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## 🛠 工具和配置
|
|
246
|
+
|
|
247
|
+
### ComponentProperties
|
|
248
|
+
组件属性配置数据,包含所有组件的默认配置和属性定义。
|
|
249
|
+
|
|
250
|
+
```javascript
|
|
251
|
+
import { Utils } from '@hbixinlian/as-editor-components'
|
|
252
|
+
const { ComponentProperties } = Utils
|
|
253
|
+
|
|
254
|
+
// 获取组件配置
|
|
255
|
+
const captionTextConfig = ComponentProperties.find(item => item.name === 'captiontext')
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### ComponentFactory
|
|
259
|
+
组件工厂,用于动态创建和管理组件。
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
import { Utils } from '@hbixinlian/as-editor-components'
|
|
263
|
+
const { ComponentFactory } = Utils
|
|
264
|
+
|
|
265
|
+
// 使用组件工厂
|
|
266
|
+
const componentInstance = ComponentFactory.createComponent('captiontext', config)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## 📝 TypeScript 支持
|
|
270
|
+
|
|
271
|
+
本组件库提供完整的TypeScript类型定义:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { ComponentRendererProps, ComponentItem, PageConfig } from '@hbixinlian/as-editor-components'
|
|
275
|
+
|
|
276
|
+
const pageConfig: PageConfig = {
|
|
277
|
+
name: '页面标题',
|
|
278
|
+
bgColor: '#f9f9f9'
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const components: ComponentItem[] = [
|
|
282
|
+
{
|
|
283
|
+
component: 'CaptionText',
|
|
284
|
+
setStyle: {
|
|
285
|
+
name: '标题'
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## 🎯 依赖要求
|
|
292
|
+
|
|
293
|
+
### Peer Dependencies
|
|
294
|
+
- Vue 3.x
|
|
295
|
+
- Vant 3.x (UI组件库)
|
|
296
|
+
- Element Plus 1.x (部分组件使用)
|
|
297
|
+
|
|
298
|
+
请确保在项目中安装这些依赖:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npm install vue@^3.0.0 vant@^3.0.0 element-plus@^1.0.0
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## 📖 完整示例
|
|
305
|
+
|
|
306
|
+
```vue
|
|
307
|
+
<template>
|
|
308
|
+
<div class="app">
|
|
309
|
+
<ComponentRenderer
|
|
310
|
+
:pageConfig="pageConfig"
|
|
311
|
+
:components="components"
|
|
312
|
+
:minHeight="600"
|
|
313
|
+
@component-click="handleClick"
|
|
314
|
+
/>
|
|
315
|
+
</div>
|
|
316
|
+
</template>
|
|
317
|
+
|
|
318
|
+
<script setup>
|
|
319
|
+
import { ref } from 'vue'
|
|
320
|
+
import { ComponentRenderer } from '@hbixinlian/as-editor-components'
|
|
321
|
+
import '@hbixinlian/as-editor-components/dist/as-editor-components.css'
|
|
322
|
+
|
|
323
|
+
const pageConfig = ref({
|
|
324
|
+
name: '商城首页',
|
|
325
|
+
bgColor: '#f9f9f9'
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
const components = ref([
|
|
329
|
+
{
|
|
330
|
+
component: 'CaptionText',
|
|
331
|
+
setStyle: {
|
|
332
|
+
name: '热门推荐',
|
|
333
|
+
wordSize: 18,
|
|
334
|
+
wordColor: '#333',
|
|
335
|
+
positions: 'center'
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
component: 'PictureAds',
|
|
340
|
+
setStyle: {
|
|
341
|
+
imageList: [
|
|
342
|
+
{ src: 'banner1.jpg', text: '广告1' },
|
|
343
|
+
{ src: 'banner2.jpg', text: '广告2' }
|
|
344
|
+
],
|
|
345
|
+
swiperType: 1,
|
|
346
|
+
borderRadius: 8
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
])
|
|
350
|
+
|
|
351
|
+
const handleClick = ({ component, index }) => {
|
|
352
|
+
console.log('点击了组件:', component.component, '索引:', index)
|
|
353
|
+
}
|
|
354
|
+
</script>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## 🔧 开发与构建
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
# 安装依赖
|
|
361
|
+
npm install
|
|
362
|
+
|
|
363
|
+
# 开发模式
|
|
364
|
+
npm run dev
|
|
365
|
+
|
|
366
|
+
# 构建库
|
|
367
|
+
npm run build:lib
|
|
368
|
+
|
|
369
|
+
# 代码检查
|
|
370
|
+
npm run lint
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## 📄 许可证
|
|
374
|
+
|
|
375
|
+
MIT License
|
|
376
|
+
|
|
377
|
+
## 🤝 贡献
|
|
378
|
+
|
|
379
|
+
欢迎提交 Issues 和 Pull Requests!
|
|
380
|
+
|
|
381
|
+
## 📞 联系
|
|
382
|
+
|
|
383
|
+
- 作者: 孤傲 <9068149@qq.com>
|
|
384
|
+
- GitHub: https://github.com/hbixinlian/as-editor
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
388
|
更多详细使用说明请参考各组件的具体文档。
|