officialblock 1.0.0 → 1.0.2
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 +140 -5
- package/dist/official-block.cjs.js +186 -1
- package/dist/official-block.es.js +22627 -70
- package/dist/official-block.umd.js +186 -1
- package/dist/style.css +1 -1
- package/package.json +12 -2
- package/src/App.vue +32 -82
- package/src/components/ArticleList/article.vue +73 -0
- package/src/components/ArticleList/contact.vue +95 -0
- package/src/components/ArticleList/index.vue +220 -48
- package/src/components/ArticleList/setting.vue +407 -0
- package/src/components/Button/index.vue +183 -0
- package/src/components/HeroSlide/index.ts +1 -0
- package/src/components/HeroSlide/index.vue +21 -3
- package/src/components/HeroSlide/type.ts +19 -0
- package/src/components/Media/index.vue +327 -0
- package/src/components/Operate/index.vue +74 -0
- package/src/components/RichTextEditor/RichTextEditor.vue +277 -0
- package/src/components/RichTextEditor/index.ts +7 -0
- package/src/components/ThemePreview/ThemePreview.vue +462 -0
- package/src/components/ThemePreview/index.ts +4 -0
- package/src/components/index.ts +14 -0
- package/src/composables/useTheme.ts +205 -0
- package/src/index.ts +26 -8
- package/src/main.ts +16 -1
- package/src/router/index.ts +84 -0
- package/src/style.css +0 -1
- package/src/styles/editor.scss +649 -0
- package/src/styles/test.scss +20 -0
- package/src/styles/variables.scss +639 -0
- package/src/types.ts +8 -0
- package/src/utils/common.ts +13 -0
- package/src/utils/theme.ts +335 -0
- package/src/views/Layout.vue +247 -0
- package/src/views/NotFound.vue +114 -0
- package/src/views/components/ArticleListDemo.vue +167 -0
- package/src/views/components/HeroSlideDemo.vue +353 -0
- package/src/views/components/RichTextEditorDemo.vue +53 -0
- package/src/views/components/ThemeDemo.vue +477 -0
- package/src/views/guide/Installation.vue +234 -0
- package/src/views/guide/Introduction.vue +174 -0
- package/src/views/guide/QuickStart.vue +265 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-page">
|
|
3
|
+
<ArticleList
|
|
4
|
+
v-model="articleListData"
|
|
5
|
+
@handle-copy="handleCopy"
|
|
6
|
+
@handle-delete="handleDelete"
|
|
7
|
+
/>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { ref } from 'vue'
|
|
13
|
+
import ArticleList from '@/components/ArticleList/index.vue'
|
|
14
|
+
|
|
15
|
+
const articleListData = ref()
|
|
16
|
+
|
|
17
|
+
const handleCopy = () => {
|
|
18
|
+
console.log('handleCopy')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const handleDelete = () => {
|
|
22
|
+
console.log('handleDelete')
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<style scoped>
|
|
27
|
+
.demo-page {
|
|
28
|
+
max-width: 1000px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.description {
|
|
32
|
+
font-size: 16px;
|
|
33
|
+
line-height: 1.6;
|
|
34
|
+
color: #606266;
|
|
35
|
+
margin-bottom: 32px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.demo-section {
|
|
39
|
+
margin: 32px 0;
|
|
40
|
+
border: 1px solid #e4e7ed;
|
|
41
|
+
border-radius: 8px;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.demo-container {
|
|
46
|
+
padding: 24px;
|
|
47
|
+
background: #fff;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.demo-code {
|
|
51
|
+
background: #f8f9fa;
|
|
52
|
+
border-top: 1px solid #e4e7ed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.demo-code pre {
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 20px;
|
|
58
|
+
overflow-x: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.demo-code code {
|
|
62
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
63
|
+
font-size: 14px;
|
|
64
|
+
line-height: 1.5;
|
|
65
|
+
color: #303133;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.size-demo {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: 16px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.size-item {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: 12px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.size-item label {
|
|
81
|
+
width: 80px;
|
|
82
|
+
font-weight: 500;
|
|
83
|
+
color: #303133;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.event-log {
|
|
87
|
+
margin-top: 20px;
|
|
88
|
+
padding: 16px;
|
|
89
|
+
background: #f8f9fa;
|
|
90
|
+
border-radius: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.event-log h4 {
|
|
94
|
+
margin: 0 0 12px 0;
|
|
95
|
+
color: #303133;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.event-log ul {
|
|
99
|
+
margin: 0;
|
|
100
|
+
padding: 0;
|
|
101
|
+
list-style: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.event-log li {
|
|
105
|
+
padding: 4px 0;
|
|
106
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
107
|
+
font-size: 12px;
|
|
108
|
+
color: #606266;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.api-section {
|
|
112
|
+
margin: 48px 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.api-table {
|
|
116
|
+
width: 100%;
|
|
117
|
+
border-collapse: collapse;
|
|
118
|
+
border: 1px solid #e4e7ed;
|
|
119
|
+
border-radius: 8px;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
margin: 16px 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.api-table th,
|
|
125
|
+
.api-table td {
|
|
126
|
+
padding: 12px 16px;
|
|
127
|
+
text-align: left;
|
|
128
|
+
border-bottom: 1px solid #e4e7ed;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.api-table th {
|
|
132
|
+
background: #f8f9fa;
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
color: #303133;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.api-table td {
|
|
138
|
+
color: #606266;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.api-table tr:last-child td {
|
|
142
|
+
border-bottom: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
h1 {
|
|
146
|
+
color: #303133;
|
|
147
|
+
font-size: 32px;
|
|
148
|
+
font-weight: 600;
|
|
149
|
+
margin-bottom: 24px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
h2 {
|
|
153
|
+
color: #303133;
|
|
154
|
+
font-size: 24px;
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
margin: 48px 0 16px 0;
|
|
157
|
+
border-bottom: 1px solid #e4e7ed;
|
|
158
|
+
padding-bottom: 8px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
h3 {
|
|
162
|
+
color: #303133;
|
|
163
|
+
font-size: 18px;
|
|
164
|
+
font-weight: 600;
|
|
165
|
+
margin: 24px 0 12px 0;
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-page">
|
|
3
|
+
<h1>HeroSlide 轮播图</h1>
|
|
4
|
+
<p class="description">
|
|
5
|
+
HeroSlide 组件用于展示轮播图,支持自动播放、指示器显示等功能。
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<h2>基础用法</h2>
|
|
9
|
+
<div class="demo-section">
|
|
10
|
+
<div class="demo-container">
|
|
11
|
+
<HeroSlide />
|
|
12
|
+
</div>
|
|
13
|
+
<div class="demo-code">
|
|
14
|
+
<pre><code><template>
|
|
15
|
+
<HeroSlide />
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
import { HeroSlide } from 'officialblock'
|
|
20
|
+
</script></code></pre>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<h2>自定义配置</h2>
|
|
25
|
+
<div class="demo-section">
|
|
26
|
+
<div class="demo-container">
|
|
27
|
+
<HeroSlide
|
|
28
|
+
:auto-play-interval="2000"
|
|
29
|
+
:show-indicators="true"
|
|
30
|
+
:auto-play="autoPlay"
|
|
31
|
+
@change="handleSlideChange"
|
|
32
|
+
/>
|
|
33
|
+
<div class="controls">
|
|
34
|
+
<button @click="toggleAutoPlay">
|
|
35
|
+
{{ autoPlay ? '停止自动播放' : '开始自动播放' }}
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="demo-code">
|
|
40
|
+
<pre><code><template>
|
|
41
|
+
<HeroSlide
|
|
42
|
+
:auto-play-interval="2000"
|
|
43
|
+
:show-indicators="true"
|
|
44
|
+
:auto-play="autoPlay"
|
|
45
|
+
@change="handleSlideChange"
|
|
46
|
+
/>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
50
|
+
import { ref } from 'vue'
|
|
51
|
+
import { HeroSlide } from 'officialblock'
|
|
52
|
+
|
|
53
|
+
const autoPlay = ref(true)
|
|
54
|
+
|
|
55
|
+
const handleSlideChange = (index) => {
|
|
56
|
+
console.log('切换到第', index + 1, '张')
|
|
57
|
+
}
|
|
58
|
+
</script></code></pre>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<h2>隐藏指示器</h2>
|
|
63
|
+
<div class="demo-section">
|
|
64
|
+
<div class="demo-container">
|
|
65
|
+
<HeroSlide
|
|
66
|
+
:show-indicators="false"
|
|
67
|
+
:auto-play="true"
|
|
68
|
+
:auto-play-interval="3000"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="demo-code">
|
|
72
|
+
<pre><code><template>
|
|
73
|
+
<HeroSlide
|
|
74
|
+
:show-indicators="false"
|
|
75
|
+
:auto-play="true"
|
|
76
|
+
:auto-play-interval="3000"
|
|
77
|
+
/>
|
|
78
|
+
</template></code></pre>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<h2>事件处理</h2>
|
|
83
|
+
<div class="demo-section">
|
|
84
|
+
<div class="demo-container">
|
|
85
|
+
<HeroSlide
|
|
86
|
+
@change="handleChange"
|
|
87
|
+
@click="handleClick"
|
|
88
|
+
/>
|
|
89
|
+
<div class="event-log">
|
|
90
|
+
<h4>事件日志:</h4>
|
|
91
|
+
<ul>
|
|
92
|
+
<li v-for="(log, index) in eventLogs" :key="index">{{ log }}</li>
|
|
93
|
+
</ul>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="demo-code">
|
|
97
|
+
<pre><code><template>
|
|
98
|
+
<HeroSlide
|
|
99
|
+
@change="handleChange"
|
|
100
|
+
@click="handleClick"
|
|
101
|
+
/>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<script setup>
|
|
105
|
+
const handleChange = (index) => {
|
|
106
|
+
console.log('幻灯片切换:', index)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const handleClick = (index) => {
|
|
110
|
+
console.log('点击幻灯片:', index)
|
|
111
|
+
}
|
|
112
|
+
</script></code></pre>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<h2>API</h2>
|
|
117
|
+
<div class="api-section">
|
|
118
|
+
<h3>Props</h3>
|
|
119
|
+
<table class="api-table">
|
|
120
|
+
<thead>
|
|
121
|
+
<tr>
|
|
122
|
+
<th>参数</th>
|
|
123
|
+
<th>说明</th>
|
|
124
|
+
<th>类型</th>
|
|
125
|
+
<th>可选值</th>
|
|
126
|
+
<th>默认值</th>
|
|
127
|
+
</tr>
|
|
128
|
+
</thead>
|
|
129
|
+
<tbody>
|
|
130
|
+
<tr>
|
|
131
|
+
<td>autoPlayInterval</td>
|
|
132
|
+
<td>自动播放间隔时间(毫秒)</td>
|
|
133
|
+
<td>number</td>
|
|
134
|
+
<td>—</td>
|
|
135
|
+
<td>3000</td>
|
|
136
|
+
</tr>
|
|
137
|
+
<tr>
|
|
138
|
+
<td>showIndicators</td>
|
|
139
|
+
<td>是否显示指示器</td>
|
|
140
|
+
<td>boolean</td>
|
|
141
|
+
<td>—</td>
|
|
142
|
+
<td>true</td>
|
|
143
|
+
</tr>
|
|
144
|
+
<tr>
|
|
145
|
+
<td>autoPlay</td>
|
|
146
|
+
<td>是否启用自动播放</td>
|
|
147
|
+
<td>boolean</td>
|
|
148
|
+
<td>—</td>
|
|
149
|
+
<td>true</td>
|
|
150
|
+
</tr>
|
|
151
|
+
</tbody>
|
|
152
|
+
</table>
|
|
153
|
+
|
|
154
|
+
<h3>Events</h3>
|
|
155
|
+
<table class="api-table">
|
|
156
|
+
<thead>
|
|
157
|
+
<tr>
|
|
158
|
+
<th>事件名</th>
|
|
159
|
+
<th>说明</th>
|
|
160
|
+
<th>回调参数</th>
|
|
161
|
+
</tr>
|
|
162
|
+
</thead>
|
|
163
|
+
<tbody>
|
|
164
|
+
<tr>
|
|
165
|
+
<td>change</td>
|
|
166
|
+
<td>幻灯片切换时触发</td>
|
|
167
|
+
<td>(index: number)</td>
|
|
168
|
+
</tr>
|
|
169
|
+
<tr>
|
|
170
|
+
<td>click</td>
|
|
171
|
+
<td>点击幻灯片时触发</td>
|
|
172
|
+
<td>(index: number)</td>
|
|
173
|
+
</tr>
|
|
174
|
+
</tbody>
|
|
175
|
+
</table>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</template>
|
|
179
|
+
|
|
180
|
+
<script setup lang="ts">
|
|
181
|
+
import { ref } from 'vue'
|
|
182
|
+
import { HeroSlide } from '../../components'
|
|
183
|
+
|
|
184
|
+
const autoPlay = ref(true)
|
|
185
|
+
const eventLogs = ref<string[]>([])
|
|
186
|
+
|
|
187
|
+
const toggleAutoPlay = () => {
|
|
188
|
+
autoPlay.value = !autoPlay.value
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const handleSlideChange = (index: number) => {
|
|
192
|
+
console.log('切换到第', index + 1, '张')
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const handleChange = (index: number) => {
|
|
196
|
+
eventLogs.value.unshift(`change: 切换到第 ${index + 1} 张 (${new Date().toLocaleTimeString()})`)
|
|
197
|
+
if (eventLogs.value.length > 5) {
|
|
198
|
+
eventLogs.value.pop()
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const handleClick = (index: number) => {
|
|
203
|
+
eventLogs.value.unshift(`click: 点击第 ${index + 1} 张 (${new Date().toLocaleTimeString()})`)
|
|
204
|
+
if (eventLogs.value.length > 5) {
|
|
205
|
+
eventLogs.value.pop()
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<style scoped>
|
|
211
|
+
.demo-page {
|
|
212
|
+
max-width: 1000px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.description {
|
|
216
|
+
font-size: 16px;
|
|
217
|
+
line-height: 1.6;
|
|
218
|
+
color: #606266;
|
|
219
|
+
margin-bottom: 32px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.demo-section {
|
|
223
|
+
margin: 32px 0;
|
|
224
|
+
border: 1px solid #e4e7ed;
|
|
225
|
+
border-radius: 8px;
|
|
226
|
+
overflow: hidden;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.demo-container {
|
|
230
|
+
padding: 24px;
|
|
231
|
+
background: #fff;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.demo-code {
|
|
235
|
+
background: #f8f9fa;
|
|
236
|
+
border-top: 1px solid #e4e7ed;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.demo-code pre {
|
|
240
|
+
margin: 0;
|
|
241
|
+
padding: 20px;
|
|
242
|
+
overflow-x: auto;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.demo-code code {
|
|
246
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
247
|
+
font-size: 14px;
|
|
248
|
+
line-height: 1.5;
|
|
249
|
+
color: #303133;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.controls {
|
|
253
|
+
margin-top: 16px;
|
|
254
|
+
text-align: center;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.controls button {
|
|
258
|
+
padding: 8px 16px;
|
|
259
|
+
background: #409eff;
|
|
260
|
+
color: white;
|
|
261
|
+
border: none;
|
|
262
|
+
border-radius: 4px;
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
font-size: 14px;
|
|
265
|
+
transition: background-color 0.3s;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.controls button:hover {
|
|
269
|
+
background: #337ecc;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.event-log {
|
|
273
|
+
margin-top: 20px;
|
|
274
|
+
padding: 16px;
|
|
275
|
+
background: #f8f9fa;
|
|
276
|
+
border-radius: 8px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.event-log h4 {
|
|
280
|
+
margin: 0 0 12px 0;
|
|
281
|
+
color: #303133;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.event-log ul {
|
|
285
|
+
margin: 0;
|
|
286
|
+
padding: 0;
|
|
287
|
+
list-style: none;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.event-log li {
|
|
291
|
+
padding: 4px 0;
|
|
292
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
293
|
+
font-size: 12px;
|
|
294
|
+
color: #606266;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.api-section {
|
|
298
|
+
margin: 48px 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.api-table {
|
|
302
|
+
width: 100%;
|
|
303
|
+
border-collapse: collapse;
|
|
304
|
+
border: 1px solid #e4e7ed;
|
|
305
|
+
border-radius: 8px;
|
|
306
|
+
overflow: hidden;
|
|
307
|
+
margin: 16px 0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.api-table th,
|
|
311
|
+
.api-table td {
|
|
312
|
+
padding: 12px 16px;
|
|
313
|
+
text-align: left;
|
|
314
|
+
border-bottom: 1px solid #e4e7ed;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.api-table th {
|
|
318
|
+
background: #f8f9fa;
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
color: #303133;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.api-table td {
|
|
324
|
+
color: #606266;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.api-table tr:last-child td {
|
|
328
|
+
border-bottom: none;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
h1 {
|
|
332
|
+
color: #303133;
|
|
333
|
+
font-size: 32px;
|
|
334
|
+
font-weight: 600;
|
|
335
|
+
margin-bottom: 24px;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
h2 {
|
|
339
|
+
color: #303133;
|
|
340
|
+
font-size: 24px;
|
|
341
|
+
font-weight: 600;
|
|
342
|
+
margin: 48px 0 16px 0;
|
|
343
|
+
border-bottom: 1px solid #e4e7ed;
|
|
344
|
+
padding-bottom: 8px;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
h3 {
|
|
348
|
+
color: #303133;
|
|
349
|
+
font-size: 18px;
|
|
350
|
+
font-weight: 600;
|
|
351
|
+
margin: 24px 0 12px 0;
|
|
352
|
+
}
|
|
353
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-container">
|
|
3
|
+
<div class="demo-header">
|
|
4
|
+
<h1>RichTextEditor 富文本编辑器</h1>
|
|
5
|
+
<p>基于 wangEditor 封装的 Vue 3 富文本编辑器组件。</p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<a-card title="基础用法" class="demo-section">
|
|
9
|
+
<RichTextEditor
|
|
10
|
+
v-model="content"
|
|
11
|
+
placeholder="请输入文章内容..."
|
|
12
|
+
height="300px"
|
|
13
|
+
/>
|
|
14
|
+
</a-card>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { ref } from 'vue'
|
|
20
|
+
import RichTextEditor from '@/components/RichTextEditor'
|
|
21
|
+
|
|
22
|
+
const content = ref('<p>这是一个富文本编辑器示例</p>')
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style scoped>
|
|
26
|
+
.demo-container {
|
|
27
|
+
padding: 24px;
|
|
28
|
+
max-width: 1200px;
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.demo-header {
|
|
33
|
+
margin-bottom: 32px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.demo-header h1 {
|
|
37
|
+
margin: 0 0 8px 0;
|
|
38
|
+
font-size: 28px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
color: var(--color-text-1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.demo-header p {
|
|
44
|
+
margin: 0;
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
color: var(--color-text-2);
|
|
47
|
+
line-height: 1.6;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.demo-section {
|
|
51
|
+
margin-bottom: 24px;
|
|
52
|
+
}
|
|
53
|
+
</style>
|