Skip to content

Commit 5ecc4f2

Browse files
committed
refactor(docs): refactor all the documentation
- The latest version of `vitepress-theme-demoblock` does not support `:::demo <comment> - With `<script setup>` tag, the vitepress will give a 404 error when trying to load the demo code. Related Issue: #1879
1 parent 18f0806 commit 5ecc4f2

File tree

40 files changed

+2173
-1832
lines changed

40 files changed

+2173
-1832
lines changed

packages/devui-vue/docs/.vitepress/theme/useComponents.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Don't remove this file, because it registers the demo components.
22
import Demo from 'vitepress-theme-demoblock/dist/client/components/Demo.vue'
33
import DemoBlock from 'vitepress-theme-demoblock/dist/client/components/DemoBlock.vue'
4-
// import Demo from '../demo/Demo.vue';
5-
// import DemoBlock from '../demo/DemoBlock.vue';
64

75
export function useComponents(app) {
86
app.component('Demo', Demo)

packages/devui-vue/docs/components/accordion/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
为页面提供导航的组件。
44

5-
#### 何时使用
6-
5+
:::tip 何时使用
76
需要通过分组组织菜单的时候使用。
7+
:::
88

99
### 基本用法
1010

packages/devui-vue/docs/components/badge/index.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
图标右上角的圆形徽标数字。
44

5-
#### 何时使用
6-
5+
:::tip 何时使用
76
出现在图标右上角或列表项右方,通过不同的状态色加数字提示用户有消息需要处理时。
7+
:::
8+
9+
## 用法
810

911
### 基本徽章
1012

11-
::: demo 基本徽章类型,当有包裹元素时在右上角显示徽章和数目。
13+
基本徽章类型,当有包裹元素时在右上角显示徽章和数目。
14+
15+
::: demo
1216

1317
```vue
1418
<template>
@@ -34,7 +38,9 @@
3438

3539
### 点状徽章
3640

37-
:::demo 点状徽章类型,当有包裹元素且 `show-dot` 参数为 true 时为点状徽章,默认在右上角展示小点不显示数目。
41+
点状徽章类型,当有包裹元素且 `show-dot` 参数为 true 时为点状徽章,默认在右上角展示小点不显示数目。
42+
43+
:::demo
3844

3945
```vue
4046
<template>
@@ -63,7 +69,9 @@
6369

6470
### 计数徽章
6571

66-
:::demo 当徽章独立使用且不包裹任何元素时,只展示徽章状态色和数目。
72+
当徽章独立使用且不包裹任何元素时,只展示徽章状态色和数目。
73+
74+
:::demo
6775

6876
```vue
6977
<template>
@@ -99,7 +107,9 @@
99107

100108
### 状态徽章
101109

102-
:::demo 当徽章独立使用、不包裹任何元素且 `show-dot` 参数为 true 时为状态徽章,不同状态展示不同色点。
110+
当徽章独立使用、不包裹任何元素且 `show-dot` 参数为 true 时为状态徽章,不同状态展示不同色点。
111+
112+
:::demo
103113

104114
```vue
105115
<template>
@@ -125,7 +135,9 @@
125135

126136
### 徽章位置
127137

128-
:::demo 通过 `position` 参数设置徽章位置。
138+
通过 `position` 参数设置徽章位置。
139+
140+
:::demo
129141

130142
```vue
131143
<template>
@@ -144,7 +156,9 @@
144156

145157
### 自定义
146158

147-
:::demo 通过 `bg-color` 参数设置徽章展示状态色(此时 `status` 参数设置的徽章状态色失效),通过 `offset` 参数可设置相对于 position 的徽章偏移量。通过 ` text-color``、bgColor ` 自定义文字、背景颜色。
159+
通过 `bg-color` 参数设置徽章展示状态色(此时 `status` 参数设置的徽章状态色失效),通过 `offset` 参数可设置相对于 position 的徽章偏移量。通过 ` text-color``、bgColor ` 自定义文字、背景颜色。
160+
161+
:::demo
148162

149163
```vue
150164
<template>
@@ -164,7 +178,7 @@
164178

165179
### 隐藏徽章
166180

167-
通过 `hidden` 属性设置徽章是否可见
181+
通过 `hidden` 属性设置徽章是否可见
168182

169183
::: demo
170184

packages/devui-vue/docs/components/card/index.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
</d-card>
3131
</template>
3232
<style lang="scss">
33-
3433
.card-demo-basic {
3534
cursor: pointer;
3635
@@ -123,7 +122,6 @@
123122
</d-card>
124123
</template>
125124
<style lang="scss">
126-
127125
.card-demo-use-img {
128126
cursor: pointer;
129127
@@ -187,7 +185,6 @@
187185
</d-card>
188186
</template>
189187
<style lang="scss">
190-
191188
.card-demo-custom-area {
192189
cursor: pointer;
193190
@@ -238,8 +235,8 @@
238235

239236
### Card 参数
240237

241-
| 参数 | 类型 | 默认 | 说明 | 跳转 Demo |
242-
| :----- |:----------------------------| :-------- | :----------------------------------------------------------- | :------------------------ |
238+
| 参数 | 类型 | 默认 | 说明 | 跳转 Demo |
239+
| :----- | :-------------------------- | :-------- | :----------------------------------------------------------- | :------------------------ |
243240
| src | `string` | '' | 可选,图片路径 | [使用图片](#使用图片) |
244241
| align | [IAlignType](#ialigntype) | `'start'` | 可选,操作区域对齐方式,分别对应起始对齐,尾部对齐,拉伸对齐 | [自定义区域](#自定义区域) |
245242
| shadow | [IShadowType](#ishadowtype) | `'hover'` | 可选,设置增强阴影显示时机 | [阴影效果](#阴影效果) |
@@ -254,7 +251,7 @@
254251
| title | 卡片的主要内容描述,一般定义为卡片名称 |
255252
| subtitle | 对标题的补充,可包含标签等信息 |
256253
| actions | 决策作用,可以包含操作文本或者操作图标 |
257-
|default|自定义卡片内所有内容|
254+
| default | 自定义卡片内所有内容 |
258255

259256
### Card 类型定义
260257

packages/devui-vue/docs/components/category-search/index.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
按类型进行搜索,目前支持的类型包括:`radio``checkbox``label``textInput``numberRange``keyword`
44

5+
## 用法
6+
57
### 基本用法
68

79
:::demo
@@ -142,7 +144,9 @@ export default defineComponent({
142144

143145
### 自定义展示模板
144146

145-
:::demo 自定义分类下拉展示模板和选中后的标签展示模板。分类下拉展示模板的插槽名为`${field}Menu`,标签展示模板的插槽名为`${field}Tag``field`为分类的字段名;插槽参数为`category`参数中对应分类的数据。
147+
自定义分类下拉展示模板和选中后的标签展示模板。分类下拉展示模板的插槽名为`${field}Menu`,标签展示模板的插槽名为`${field}Tag``field`为分类的字段名;插槽参数为`category`参数中对应分类的数据。
148+
149+
:::demo
146150

147151
```vue
148152
<template>
@@ -241,7 +245,9 @@ export default defineComponent({
241245

242246
### 自定义扩展按钮
243247

244-
:::demo 自定义分类下拉展示模板和选中后的标签展示模板。分类下拉展示模板的插槽名为`${field}Menu`,标签展示模板的插槽名为`${field}Tag``field`为分类的字段名;插槽参数为`category`参数中对应分类的数据。
248+
自定义分类下拉展示模板和选中后的标签展示模板。分类下拉展示模板的插槽名为`${field}Menu`,标签展示模板的插槽名为`${field}Tag``field`为分类的字段名;插槽参数为`category`参数中对应分类的数据。
249+
250+
:::demo
245251

246252
```vue
247253
<template>
@@ -395,13 +401,13 @@ export default defineComponent({
395401

396402
### CategorySearch 方法
397403

398-
| 方法名 | 说明 | 参数 |
399-
| :------------------ | :------------------------------------------------------------------------- | :------------------------------------------------------------ |
400-
| chooseItem | 调用组件方法处理选中数据,针对`radio`类型,参数为当前 tag 和选中项 | (tag: ICategorySearchTagItem, chooseItem: ITagOption) => void |
401-
| chooseItems | 调用组件方法处理选中数据,针对`checkbox \| label`类型,参数为当前 tag | (tag: ICategorySearchTagItem) => void |
402-
| getTextInputValue | 调用组件方法处理选中数据,针对`textInput`类型,参数为当前 tag 和输入内容 | (tag: ICategorySearchTagItem, inputValue: string) => void |
403-
| getNumberRangeValue | 调用组件方法处理选中数据,针对`numberRange`类型,参数为当前 tag 和输入内容 | (tag: ICategorySearchTagItem, rangeValue: number[]) => void |
404-
|toggleTagMenu|控制某个已选择tag所对应下拉框的展开收起状态,可通过`status`参数指定展开收起状态|`(field: string, status?: boolean) => void`|
404+
| 方法名 | 说明 | 参数 |
405+
| :------------------ | :-------------------------------------------------------------------------------- | :------------------------------------------------------------ |
406+
| chooseItem | 调用组件方法处理选中数据,针对`radio`类型,参数为当前 tag 和选中项 | (tag: ICategorySearchTagItem, chooseItem: ITagOption) => void |
407+
| chooseItems | 调用组件方法处理选中数据,针对`checkbox \| label`类型,参数为当前 tag | (tag: ICategorySearchTagItem) => void |
408+
| getTextInputValue | 调用组件方法处理选中数据,针对`textInput`类型,参数为当前 tag 和输入内容 | (tag: ICategorySearchTagItem, inputValue: string) => void |
409+
| getNumberRangeValue | 调用组件方法处理选中数据,针对`numberRange`类型,参数为当前 tag 和输入内容 | (tag: ICategorySearchTagItem, rangeValue: number[]) => void |
410+
| toggleTagMenu | 控制某个已选择 tag 所对应下拉框的展开收起状态,可通过`status`参数指定展开收起状态 | `(field: string, status?: boolean) => void` |
405411

406412
### 类型定义
407413

packages/devui-vue/docs/components/code-editor/index.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
由于 monaco editor 对语法处理是通过 web Worker 实现的,所以需要加载处理语法的 Worker, 配置方式参考[官方教程](https://github.com/microsoft/monaco-editor/blob/main/docs/integrate-esm.md).
66

7+
## 用法
8+
79
### 基本用法
810

9-
:::demo `v-model`双向绑定编辑器内容,`options`参数[参考 monaco editor 定义](https://github.com/microsoft/monaco-editor/api/interfaces/monaco.editor.IEditorConstructionOptions.html)
11+
`v-model`双向绑定编辑器内容,`options`参数[参考 monaco editor 定义](https://github.com/microsoft/monaco-editor/api/interfaces/monaco.editor.IEditorConstructionOptions.html)
12+
13+
:::demo
1014

1115
```vue
1216
<template>
@@ -40,7 +44,9 @@ export default defineComponent({
4044

4145
### 代码高亮
4246

43-
:::demo 对一个代码块进行高亮
47+
对一个代码块进行高亮。
48+
49+
:::demo
4450

4551
```vue
4652
<template>

0 commit comments

Comments
 (0)