officialblock 1.0.1 → 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 +25 -1
- package/dist/official-block.cjs.js +186 -1
- package/dist/official-block.es.js +22619 -73
- 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 +215 -48
- package/src/components/ArticleList/setting.vue +407 -0
- package/src/components/Button/index.vue +183 -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 +3 -0
- package/src/composables/useTheme.ts +205 -0
- package/src/index.ts +15 -4
- 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/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,477 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-container">
|
|
3
|
+
<div class="demo-header">
|
|
4
|
+
<h1>主题系统演示</h1>
|
|
5
|
+
<p>展示项目的主题颜色、字体大小和 UnoCSS 工具类的使用效果。</p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<!-- 主题控制面板 -->
|
|
9
|
+
<a-card title="主题控制面板" class="demo-section">
|
|
10
|
+
<div class="theme-controls">
|
|
11
|
+
<div class="control-group">
|
|
12
|
+
<h4>预设主题</h4>
|
|
13
|
+
<a-radio-group v-model="selectedPreset" @change="handlePresetChange">
|
|
14
|
+
<a-radio value="default">默认</a-radio>
|
|
15
|
+
<a-radio value="dark">暗色</a-radio>
|
|
16
|
+
<a-radio value="compact">紧凑</a-radio>
|
|
17
|
+
<a-radio value="large">大号</a-radio>
|
|
18
|
+
</a-radio-group>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="control-group">
|
|
22
|
+
<h4>自定义主色调</h4>
|
|
23
|
+
<div class="flex items-center gap-3">
|
|
24
|
+
<input
|
|
25
|
+
type="color"
|
|
26
|
+
v-model="customColor"
|
|
27
|
+
class="color-picker"
|
|
28
|
+
@change="handleCustomColorChange"
|
|
29
|
+
>
|
|
30
|
+
<a-input
|
|
31
|
+
v-model="customColor"
|
|
32
|
+
placeholder="输入颜色值"
|
|
33
|
+
class="w-32"
|
|
34
|
+
@change="handleCustomColorChange"
|
|
35
|
+
/>
|
|
36
|
+
<span class="text-sm text-muted">当前: {{ currentTheme.primaryColor }}</span>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="control-group">
|
|
41
|
+
<h4>字体大小</h4>
|
|
42
|
+
<div class="flex items-center gap-3">
|
|
43
|
+
<a-select
|
|
44
|
+
v-model="customFontSize"
|
|
45
|
+
class="w-24"
|
|
46
|
+
@change="handleFontSizeChange"
|
|
47
|
+
>
|
|
48
|
+
<a-option value="12px">12px</a-option>
|
|
49
|
+
<a-option value="14px">14px</a-option>
|
|
50
|
+
<a-option value="16px">16px</a-option>
|
|
51
|
+
<a-option value="18px">18px</a-option>
|
|
52
|
+
</a-select>
|
|
53
|
+
<span class="text-sm text-muted">当前: {{ currentTheme.fontSize }}</span>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div class="control-group">
|
|
58
|
+
<h4>模式切换</h4>
|
|
59
|
+
<div class="flex items-center gap-4">
|
|
60
|
+
<a-switch
|
|
61
|
+
v-model="isDarkMode"
|
|
62
|
+
@change="handleDarkModeToggle"
|
|
63
|
+
>
|
|
64
|
+
<template #checked>🌙</template>
|
|
65
|
+
<template #unchecked>☀️</template>
|
|
66
|
+
</a-switch>
|
|
67
|
+
<span class="text-sm text-muted">{{ isDarkMode ? '暗色模式' : '亮色模式' }}</span>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="control-group">
|
|
72
|
+
<h4>操作</h4>
|
|
73
|
+
<div class="flex gap-2">
|
|
74
|
+
<a-button type="primary" @click="handleExport">
|
|
75
|
+
导出配置
|
|
76
|
+
</a-button>
|
|
77
|
+
<a-button @click="handleReset">
|
|
78
|
+
重置主题
|
|
79
|
+
</a-button>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</a-card>
|
|
84
|
+
|
|
85
|
+
<!-- 主题预览 -->
|
|
86
|
+
<a-card title="实时预览" class="demo-section">
|
|
87
|
+
<ThemePreview />
|
|
88
|
+
</a-card>
|
|
89
|
+
|
|
90
|
+
<!-- 颜色系统演示 -->
|
|
91
|
+
<a-card title="主题颜色系统" class="demo-section">
|
|
92
|
+
<div class="color-grid">
|
|
93
|
+
<!-- 主色调 -->
|
|
94
|
+
<div class="color-group">
|
|
95
|
+
<h3>主色调 (Primary)</h3>
|
|
96
|
+
<div class="color-palette">
|
|
97
|
+
<div class="color-item bg-primary-50 text-primary-900">50</div>
|
|
98
|
+
<div class="color-item bg-primary-100 text-primary-900">100</div>
|
|
99
|
+
<div class="color-item bg-primary-200 text-primary-900">200</div>
|
|
100
|
+
<div class="color-item bg-primary-300 text-primary-900">300</div>
|
|
101
|
+
<div class="color-item bg-primary-400 text-white">400</div>
|
|
102
|
+
<div class="color-item bg-primary-500 text-white font-bold">500</div>
|
|
103
|
+
<div class="color-item bg-primary-600 text-white">600</div>
|
|
104
|
+
<div class="color-item bg-primary-700 text-white">700</div>
|
|
105
|
+
<div class="color-item bg-primary-800 text-white">800</div>
|
|
106
|
+
<div class="color-item bg-primary-900 text-white">900</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<!-- 辅助色 -->
|
|
111
|
+
<div class="color-group">
|
|
112
|
+
<h3>辅助色 (Secondary)</h3>
|
|
113
|
+
<div class="color-palette">
|
|
114
|
+
<div class="color-item bg-secondary-50 text-secondary-900">50</div>
|
|
115
|
+
<div class="color-item bg-secondary-100 text-secondary-900">100</div>
|
|
116
|
+
<div class="color-item bg-secondary-200 text-secondary-900">200</div>
|
|
117
|
+
<div class="color-item bg-secondary-300 text-secondary-900">300</div>
|
|
118
|
+
<div class="color-item bg-secondary-400 text-white">400</div>
|
|
119
|
+
<div class="color-item bg-secondary-500 text-white font-bold">500</div>
|
|
120
|
+
<div class="color-item bg-secondary-600 text-white">600</div>
|
|
121
|
+
<div class="color-item bg-secondary-700 text-white">700</div>
|
|
122
|
+
<div class="color-item bg-secondary-800 text-white">800</div>
|
|
123
|
+
<div class="color-item bg-secondary-900 text-white">900</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<!-- 功能色 -->
|
|
128
|
+
<div class="color-group">
|
|
129
|
+
<h3>功能色</h3>
|
|
130
|
+
<div class="functional-colors">
|
|
131
|
+
<div class="color-item bg-success-500 text-white">Success</div>
|
|
132
|
+
<div class="color-item bg-warning-500 text-white">Warning</div>
|
|
133
|
+
<div class="color-item bg-error-500 text-white">Error</div>
|
|
134
|
+
<div class="color-item bg-gray-500 text-white">Gray</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</a-card>
|
|
139
|
+
|
|
140
|
+
<!-- 字体系统演示 -->
|
|
141
|
+
<a-card title="字体系统" class="demo-section">
|
|
142
|
+
<div class="typography-demo">
|
|
143
|
+
<div class="font-sizes">
|
|
144
|
+
<h3>字体大小</h3>
|
|
145
|
+
<div class="text-xs mb-2">Extra Small (12px) - text-xs</div>
|
|
146
|
+
<div class="text-sm mb-2">Small (14px) - text-sm - 默认字号</div>
|
|
147
|
+
<div class="text-base mb-2">Base (16px) - text-base</div>
|
|
148
|
+
<div class="text-lg mb-2">Large (18px) - text-lg</div>
|
|
149
|
+
<div class="text-xl mb-2">Extra Large (20px) - text-xl</div>
|
|
150
|
+
<div class="text-2xl mb-2">2X Large (24px) - text-2xl</div>
|
|
151
|
+
<div class="text-3xl mb-2">3X Large (30px) - text-3xl</div>
|
|
152
|
+
<div class="text-4xl mb-2">4X Large (36px) - text-4xl</div>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div class="font-families mt-6">
|
|
156
|
+
<h3>字体族</h3>
|
|
157
|
+
<div class="font-sans mb-2">Sans Serif Font - Inter (font-sans)</div>
|
|
158
|
+
<div class="font-mono mb-2">Monospace Font - JetBrains Mono (font-mono)</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</a-card>
|
|
162
|
+
|
|
163
|
+
<!-- UnoCSS 工具类演示 -->
|
|
164
|
+
<a-card title="UnoCSS 工具类演示" class="demo-section">
|
|
165
|
+
<div class="utilities-demo">
|
|
166
|
+
<!-- 按钮样式 -->
|
|
167
|
+
<div class="utility-group">
|
|
168
|
+
<h3>按钮样式</h3>
|
|
169
|
+
<div class="flex gap-4 flex-wrap">
|
|
170
|
+
<button class="btn-primary">Primary Button</button>
|
|
171
|
+
<button class="btn-secondary">Secondary Button</button>
|
|
172
|
+
<button class="btn-outline">Outline Button</button>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<!-- 卡片样式 -->
|
|
177
|
+
<div class="utility-group">
|
|
178
|
+
<h3>卡片样式</h3>
|
|
179
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
180
|
+
<div class="card p-4">
|
|
181
|
+
<h4 class="text-lg font-semibold mb-2">基础卡片</h4>
|
|
182
|
+
<p class="text-muted">这是一个基础卡片样式,使用了 card 工具类。</p>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="card-hover p-4">
|
|
185
|
+
<h4 class="text-lg font-semibold mb-2">悬停卡片</h4>
|
|
186
|
+
<p class="text-muted">这是一个带悬停效果的卡片,使用了 card-hover 工具类。</p>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<!-- 输入框样式 -->
|
|
192
|
+
<div class="utility-group">
|
|
193
|
+
<h3>输入框样式</h3>
|
|
194
|
+
<div class="space-y-4">
|
|
195
|
+
<input type="text" class="input w-full" placeholder="使用 input 工具类的输入框">
|
|
196
|
+
<textarea class="input w-full h-24 resize-none" placeholder="文本域示例"></textarea>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<!-- 布局工具类 -->
|
|
201
|
+
<div class="utility-group">
|
|
202
|
+
<h3>布局工具类</h3>
|
|
203
|
+
<div class="space-y-4">
|
|
204
|
+
<div class="flex-center h-16 bg-gray-100 rounded">
|
|
205
|
+
<span>flex-center - 居中对齐</span>
|
|
206
|
+
</div>
|
|
207
|
+
<div class="flex-between h-16 bg-gray-100 rounded px-4">
|
|
208
|
+
<span>左侧内容</span>
|
|
209
|
+
<span>flex-between - 两端对齐</span>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<!-- 文本样式 -->
|
|
215
|
+
<div class="utility-group">
|
|
216
|
+
<h3>文本样式</h3>
|
|
217
|
+
<div class="space-y-2">
|
|
218
|
+
<p class="text-emphasis">强调文本 - text-emphasis</p>
|
|
219
|
+
<p class="text-muted">次要文本 - text-muted</p>
|
|
220
|
+
<p class="text-theme-primary">主题色文本 - text-theme-primary</p>
|
|
221
|
+
<p class="text-default">默认字号文本 - text-default</p>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
</a-card>
|
|
226
|
+
|
|
227
|
+
<!-- 响应式演示 -->
|
|
228
|
+
<a-card title="响应式设计" class="demo-section">
|
|
229
|
+
<div class="container-responsive">
|
|
230
|
+
<h3>响应式容器</h3>
|
|
231
|
+
<p class="text-muted mb-4">这个容器使用了 container-responsive 类,会根据屏幕大小自动调整内边距。</p>
|
|
232
|
+
|
|
233
|
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
|
234
|
+
<div class="card p-4 text-center" v-for="i in 8" :key="i">
|
|
235
|
+
<div class="w-12 h-12 bg-primary-500 rounded-full mx-auto mb-2"></div>
|
|
236
|
+
<p class="text-sm">响应式网格 {{ i }}</p>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
</a-card>
|
|
241
|
+
|
|
242
|
+
<!-- 动画演示 -->
|
|
243
|
+
<a-card title="动画效果" class="demo-section">
|
|
244
|
+
<div class="animation-demo">
|
|
245
|
+
<h3>过渡动画</h3>
|
|
246
|
+
<div class="flex gap-4 flex-wrap">
|
|
247
|
+
<button
|
|
248
|
+
class="btn-primary transition-fast transform hover:scale-105"
|
|
249
|
+
@click="showMessage('快速过渡')"
|
|
250
|
+
>
|
|
251
|
+
快速过渡 (150ms)
|
|
252
|
+
</button>
|
|
253
|
+
<button
|
|
254
|
+
class="btn-secondary transition-normal transform hover:scale-105"
|
|
255
|
+
@click="showMessage('正常过渡')"
|
|
256
|
+
>
|
|
257
|
+
正常过渡 (200ms)
|
|
258
|
+
</button>
|
|
259
|
+
<button
|
|
260
|
+
class="btn-outline transition-slow transform hover:scale-105"
|
|
261
|
+
@click="showMessage('慢速过渡')"
|
|
262
|
+
>
|
|
263
|
+
慢速过渡 (300ms)
|
|
264
|
+
</button>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
</a-card>
|
|
268
|
+
</div>
|
|
269
|
+
</template>
|
|
270
|
+
|
|
271
|
+
<script setup lang="ts">
|
|
272
|
+
import { ref, onMounted } from 'vue'
|
|
273
|
+
import { Message } from '@arco-design/web-vue'
|
|
274
|
+
import { useTheme } from '@/composables/useTheme'
|
|
275
|
+
import ThemePreview from '@/components/ThemePreview'
|
|
276
|
+
|
|
277
|
+
const {
|
|
278
|
+
currentTheme,
|
|
279
|
+
isDarkMode,
|
|
280
|
+
themePresets,
|
|
281
|
+
setTheme,
|
|
282
|
+
updateTheme,
|
|
283
|
+
toggleDarkMode,
|
|
284
|
+
resetTheme,
|
|
285
|
+
exportTheme,
|
|
286
|
+
importTheme,
|
|
287
|
+
initTheme,
|
|
288
|
+
saveTheme
|
|
289
|
+
} = useTheme()
|
|
290
|
+
|
|
291
|
+
const selectedPreset = ref('default')
|
|
292
|
+
const customColor = ref('#3b82f6')
|
|
293
|
+
const customFontSize = ref('14px')
|
|
294
|
+
|
|
295
|
+
const showMessage = (content: string) => {
|
|
296
|
+
Message.success(content)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const handlePresetChange = (preset: string) => {
|
|
300
|
+
selectedPreset.value = preset
|
|
301
|
+
setTheme(preset as keyof typeof themePresets)
|
|
302
|
+
saveTheme()
|
|
303
|
+
showMessage(`已切换到 ${preset} 主题`)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const handleCustomColorChange = () => {
|
|
307
|
+
updateTheme({ primaryColor: customColor.value })
|
|
308
|
+
saveTheme()
|
|
309
|
+
showMessage('主色调已更新')
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const handleFontSizeChange = () => {
|
|
313
|
+
updateTheme({ fontSize: customFontSize.value })
|
|
314
|
+
saveTheme()
|
|
315
|
+
showMessage('字体大小已更新')
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const handleDarkModeToggle = () => {
|
|
319
|
+
toggleDarkMode()
|
|
320
|
+
saveTheme()
|
|
321
|
+
showMessage(isDarkMode.value ? '已切换到暗色模式' : '已切换到亮色模式')
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const handleReset = () => {
|
|
325
|
+
resetTheme()
|
|
326
|
+
selectedPreset.value = 'default'
|
|
327
|
+
customColor.value = '#3b82f6'
|
|
328
|
+
customFontSize.value = '14px'
|
|
329
|
+
saveTheme()
|
|
330
|
+
showMessage('主题已重置')
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const handleExport = () => {
|
|
334
|
+
const themeConfig = exportTheme()
|
|
335
|
+
navigator.clipboard.writeText(themeConfig).then(() => {
|
|
336
|
+
showMessage('主题配置已复制到剪贴板')
|
|
337
|
+
}).catch(() => {
|
|
338
|
+
console.log('Theme config:', themeConfig)
|
|
339
|
+
showMessage('主题配置已输出到控制台')
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
onMounted(() => {
|
|
344
|
+
initTheme()
|
|
345
|
+
customColor.value = currentTheme.value.primaryColor
|
|
346
|
+
customFontSize.value = currentTheme.value.fontSize
|
|
347
|
+
})
|
|
348
|
+
</script>
|
|
349
|
+
|
|
350
|
+
<style scoped>
|
|
351
|
+
.demo-container {
|
|
352
|
+
padding: 24px;
|
|
353
|
+
max-width: 1200px;
|
|
354
|
+
margin: 0 auto;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.demo-header {
|
|
358
|
+
margin-bottom: 32px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.demo-header h1 {
|
|
362
|
+
margin: 0 0 8px 0;
|
|
363
|
+
font-size: 28px;
|
|
364
|
+
font-weight: 600;
|
|
365
|
+
color: var(--theme-gray-900);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.demo-header p {
|
|
369
|
+
margin: 0;
|
|
370
|
+
font-size: 16px;
|
|
371
|
+
color: var(--theme-gray-600);
|
|
372
|
+
line-height: 1.6;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.demo-section {
|
|
376
|
+
margin-bottom: 24px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.theme-controls {
|
|
380
|
+
display: grid;
|
|
381
|
+
gap: 24px;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.control-group h4 {
|
|
385
|
+
margin: 0 0 12px 0;
|
|
386
|
+
font-size: 16px;
|
|
387
|
+
font-weight: 600;
|
|
388
|
+
color: var(--theme-gray-800);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.color-picker {
|
|
392
|
+
width: 40px;
|
|
393
|
+
height: 32px;
|
|
394
|
+
border: 1px solid var(--theme-gray-300);
|
|
395
|
+
border-radius: 6px;
|
|
396
|
+
cursor: pointer;
|
|
397
|
+
background: none;
|
|
398
|
+
padding: 0;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.color-picker::-webkit-color-swatch-wrapper {
|
|
402
|
+
padding: 0;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.color-picker::-webkit-color-swatch {
|
|
406
|
+
border: none;
|
|
407
|
+
border-radius: 4px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.color-grid {
|
|
411
|
+
display: grid;
|
|
412
|
+
gap: 24px;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.color-group h3 {
|
|
416
|
+
margin-bottom: 12px;
|
|
417
|
+
font-size: 18px;
|
|
418
|
+
font-weight: 600;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.color-palette {
|
|
422
|
+
display: grid;
|
|
423
|
+
grid-template-columns: repeat(10, 1fr);
|
|
424
|
+
gap: 4px;
|
|
425
|
+
margin-bottom: 16px;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.functional-colors {
|
|
429
|
+
display: grid;
|
|
430
|
+
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
|
431
|
+
gap: 8px;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.color-item {
|
|
435
|
+
padding: 12px 8px;
|
|
436
|
+
text-align: center;
|
|
437
|
+
font-size: 12px;
|
|
438
|
+
font-weight: 500;
|
|
439
|
+
border-radius: 6px;
|
|
440
|
+
min-height: 48px;
|
|
441
|
+
display: flex;
|
|
442
|
+
align-items: center;
|
|
443
|
+
justify-content: center;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.typography-demo {
|
|
447
|
+
display: grid;
|
|
448
|
+
gap: 24px;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.utilities-demo {
|
|
452
|
+
display: grid;
|
|
453
|
+
gap: 32px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.utility-group h3 {
|
|
457
|
+
margin-bottom: 16px;
|
|
458
|
+
font-size: 18px;
|
|
459
|
+
font-weight: 600;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.animation-demo h3 {
|
|
463
|
+
margin-bottom: 16px;
|
|
464
|
+
font-size: 18px;
|
|
465
|
+
font-weight: 600;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
@media (max-width: 768px) {
|
|
469
|
+
.color-palette {
|
|
470
|
+
grid-template-columns: repeat(5, 1fr);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.functional-colors {
|
|
474
|
+
grid-template-columns: repeat(2, 1fr);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
</style>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page">
|
|
3
|
+
<h1>安装</h1>
|
|
4
|
+
|
|
5
|
+
<h2>环境要求</h2>
|
|
6
|
+
<ul>
|
|
7
|
+
<li>Node.js 16+ 或 18+</li>
|
|
8
|
+
<li>Vue 3.0+</li>
|
|
9
|
+
</ul>
|
|
10
|
+
|
|
11
|
+
<h2>使用包管理器安装</h2>
|
|
12
|
+
|
|
13
|
+
<h3>npm</h3>
|
|
14
|
+
<div class="code-block">
|
|
15
|
+
<pre><code>npm install officialblock</code></pre>
|
|
16
|
+
<button class="copy-btn" @click="copyCode('npm install officialblock')">复制</button>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<h3>yarn</h3>
|
|
20
|
+
<div class="code-block">
|
|
21
|
+
<pre><code>yarn add officialblock</code></pre>
|
|
22
|
+
<button class="copy-btn" @click="copyCode('yarn add officialblock')">复制</button>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<h3>pnpm</h3>
|
|
26
|
+
<div class="code-block">
|
|
27
|
+
<pre><code>pnpm add officialblock</code></pre>
|
|
28
|
+
<button class="copy-btn" @click="copyCode('pnpm add officialblock')">复制</button>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<h2>CDN 引入</h2>
|
|
32
|
+
<p>通过 CDN 的方式引入,适合快速原型开发。</p>
|
|
33
|
+
|
|
34
|
+
<div class="code-block">
|
|
35
|
+
<pre><code><!-- 引入样式 -->
|
|
36
|
+
<link rel="stylesheet" href="https://unpkg.com/officialblock/dist/style.css">
|
|
37
|
+
|
|
38
|
+
<!-- 引入组件库 -->
|
|
39
|
+
<script src="https://unpkg.com/officialblock/dist/official-block.umd.js"></script></code></pre>
|
|
40
|
+
<button class="copy-btn" @click="copyCode(cdnCode)">复制</button>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div class="tip">
|
|
44
|
+
<p><strong>提示:</strong>我们建议使用 CDN 引入 OfficialBlock 的用户在链接地址上锁定版本,以免将来 OfficialBlock 升级时受到非兼容性更新的影响。</p>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<h2>Hello World</h2>
|
|
48
|
+
<p>通过 CDN 的方式我们可以很容易地使用 OfficialBlock 写出一个 Hello world 页面。</p>
|
|
49
|
+
|
|
50
|
+
<div class="code-block">
|
|
51
|
+
<pre><code><!DOCTYPE html>
|
|
52
|
+
<html>
|
|
53
|
+
<head>
|
|
54
|
+
<meta charset="UTF-8">
|
|
55
|
+
<title>Hello OfficialBlock</title>
|
|
56
|
+
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
57
|
+
<link rel="stylesheet" href="https://unpkg.com/officialblock/dist/style.css">
|
|
58
|
+
<script src="https://unpkg.com/officialblock/dist/official-block.umd.js"></script>
|
|
59
|
+
</head>
|
|
60
|
+
<body>
|
|
61
|
+
<div id="app">
|
|
62
|
+
<article-list v-model="message"></article-list>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
const { createApp } = Vue
|
|
67
|
+
const { OfficialBlock } = window.OfficialBlock
|
|
68
|
+
|
|
69
|
+
createApp({
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
message: 'Hello OfficialBlock!'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
.use(OfficialBlock.default)
|
|
77
|
+
.mount('#app')
|
|
78
|
+
</script>
|
|
79
|
+
</body>
|
|
80
|
+
</html></code></pre>
|
|
81
|
+
<button class="copy-btn" @click="copyCode(helloWorldCode)">复制</button>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
import { ref } from 'vue'
|
|
88
|
+
|
|
89
|
+
const cdnCode = `<!-- 引入样式 -->
|
|
90
|
+
<link rel="stylesheet" href="https://unpkg.com/officialblock/dist/style.css">
|
|
91
|
+
|
|
92
|
+
<!-- 引入组件库 -->
|
|
93
|
+
<script src="https://unpkg.com/officialblock/dist/official-block.umd.js"><\/script>`
|
|
94
|
+
|
|
95
|
+
const helloWorldCode = `<!DOCTYPE html>
|
|
96
|
+
<html>
|
|
97
|
+
<head>
|
|
98
|
+
<meta charset="UTF-8">
|
|
99
|
+
<title>Hello OfficialBlock</title>
|
|
100
|
+
<script src="https://unpkg.com/vue@3/dist/vue.global.js"><\/script>
|
|
101
|
+
<link rel="stylesheet" href="https://unpkg.com/officialblock/dist/style.css">
|
|
102
|
+
<script src="https://unpkg.com/officialblock/dist/official-block.umd.js"><\/script>
|
|
103
|
+
</head>
|
|
104
|
+
<body>
|
|
105
|
+
<div id="app">
|
|
106
|
+
<article-list v-model="message"></article-list>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<script>
|
|
110
|
+
const { createApp } = Vue
|
|
111
|
+
const { OfficialBlock } = window.OfficialBlock
|
|
112
|
+
|
|
113
|
+
createApp({
|
|
114
|
+
data() {
|
|
115
|
+
return {
|
|
116
|
+
message: 'Hello OfficialBlock!'
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
.use(OfficialBlock.default)
|
|
121
|
+
.mount('#app')
|
|
122
|
+
<\/script>
|
|
123
|
+
</body>
|
|
124
|
+
</html>`
|
|
125
|
+
|
|
126
|
+
const copyCode = async (code: string) => {
|
|
127
|
+
try {
|
|
128
|
+
await navigator.clipboard.writeText(code)
|
|
129
|
+
// 这里可以添加复制成功的提示
|
|
130
|
+
console.log('代码已复制到剪贴板')
|
|
131
|
+
} catch (err) {
|
|
132
|
+
console.error('复制失败:', err)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<style scoped>
|
|
138
|
+
.page {
|
|
139
|
+
max-width: 800px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.code-block {
|
|
143
|
+
position: relative;
|
|
144
|
+
margin: 16px 0;
|
|
145
|
+
background: #f8f9fa;
|
|
146
|
+
border: 1px solid #e4e7ed;
|
|
147
|
+
border-radius: 8px;
|
|
148
|
+
overflow: hidden;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.code-block pre {
|
|
152
|
+
margin: 0;
|
|
153
|
+
padding: 20px;
|
|
154
|
+
overflow-x: auto;
|
|
155
|
+
background: transparent;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.code-block code {
|
|
159
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
line-height: 1.5;
|
|
162
|
+
color: #303133;
|
|
163
|
+
background: transparent;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.copy-btn {
|
|
167
|
+
position: absolute;
|
|
168
|
+
top: 12px;
|
|
169
|
+
right: 12px;
|
|
170
|
+
padding: 6px 12px;
|
|
171
|
+
background: #409eff;
|
|
172
|
+
color: white;
|
|
173
|
+
border: none;
|
|
174
|
+
border-radius: 4px;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
transition: background-color 0.3s;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.copy-btn:hover {
|
|
181
|
+
background: #337ecc;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.tip {
|
|
185
|
+
background: #f0f9ff;
|
|
186
|
+
border: 1px solid #b3d8ff;
|
|
187
|
+
border-radius: 8px;
|
|
188
|
+
padding: 16px;
|
|
189
|
+
margin: 24px 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.tip p {
|
|
193
|
+
margin: 0;
|
|
194
|
+
color: #409eff;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
h1 {
|
|
198
|
+
color: #303133;
|
|
199
|
+
font-size: 32px;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
margin-bottom: 24px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
h2 {
|
|
205
|
+
color: #303133;
|
|
206
|
+
font-size: 24px;
|
|
207
|
+
font-weight: 600;
|
|
208
|
+
margin: 32px 0 16px 0;
|
|
209
|
+
border-bottom: 1px solid #e4e7ed;
|
|
210
|
+
padding-bottom: 8px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
h3 {
|
|
214
|
+
color: #303133;
|
|
215
|
+
font-size: 18px;
|
|
216
|
+
font-weight: 600;
|
|
217
|
+
margin: 24px 0 12px 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
p {
|
|
221
|
+
line-height: 1.6;
|
|
222
|
+
color: #606266;
|
|
223
|
+
margin-bottom: 16px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
ul {
|
|
227
|
+
color: #606266;
|
|
228
|
+
line-height: 1.6;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
li {
|
|
232
|
+
margin-bottom: 8px;
|
|
233
|
+
}
|
|
234
|
+
</style>
|