Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 20bf7ea

Browse files
committed
docs(plugin-table-of-contents): add component props
1 parent 5174e3e commit 20bf7ea

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

packages/docs/src/en/plugins/table-of-contents.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ module.exports = {
2121
}
2222
```
2323

24-
This plugin will register a `<TOC />` component for you, which will render the table-of-contents of current page.
24+
This plugin will register a `<TOC />` component for you, which will render the table-of-contents of current page. You can use it in your markdown and vue files.
25+
26+
```md
27+
<!-- README.md / Component.vue -->
28+
29+
<TOC />
30+
```
2531

2632
## Configs
2733

@@ -32,6 +38,17 @@ This plugin will register a `<TOC />` component for you, which will render the t
3238

3339
Name of the table-of-contents component.
3440

41+
## Component Props
42+
43+
### includeLevel
44+
45+
- **type:** `[number, number]`
46+
- **default:** `[2, 3]`
47+
48+
The level of title to be included in `<TOC />` component.
49+
50+
For example, `[2, 4]` means 2 <= x <= 4.
51+
3552
## Demo
3653

3754
### Input
@@ -44,6 +61,16 @@ Name of the table-of-contents component.
4461

4562
<TOC />
4663

64+
### Input
65+
66+
```md
67+
<TOC :include-level="[2, 2]" />
68+
```
69+
70+
### Output
71+
72+
<TOC :include-level="[2, 2]" />
73+
4774
## Differences from VuePress markdown toc syntax
4875

4976
You may notice that VuePress also provides a [markdown syntax `[[toc]]`](https://vuepress.vuejs.org/guide/markdown.html#table-of-contents) for table-of-contents.

packages/docs/src/zh/plugins/table-of-contents.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ module.exports = {
2121
}
2222
```
2323

24-
该组件会为你注册一个 `<TOC />` 组件,该组件展示你当前页面文章的目录。
24+
该组件会为你注册一个 `<TOC />` 组件,该组件展示你当前页面文章的目录,你可以在 Markdown 文件和 Vue 文件中使用它。
25+
26+
```md
27+
<!-- README.md / Component.vue -->
28+
29+
<TOC />
30+
```
2531

2632
## 配置项
2733

@@ -32,6 +38,17 @@ module.exports = {
3238

3339
组件的名称。
3440

41+
## 组件 Props
42+
43+
### includeLevel
44+
45+
- **类型:** `[number, number]`
46+
- **默认值:** `[2, 3]`
47+
48+
`<TOC />` 组件包含的标题范围。
49+
50+
例如,`[2, 4]` 代表 2 <= x <= 4 。
51+
3552
## 演示
3653

3754
### 输入
@@ -44,6 +61,16 @@ module.exports = {
4461

4562
<TOC />
4663

64+
### 输入
65+
66+
```md
67+
<TOC :include-level="[2, 2]" />
68+
```
69+
70+
### 输出
71+
72+
<TOC :include-level="[2, 2]" />
73+
4774
## 与 VuePress markdown 目录语法的区别
4875

4976
你可能注意到 VuePress 也提供了一种 [markdown 语法 `[[toc]]`](https://vuepress.vuejs.org/zh/guide/markdown.html#table-of-contents) 来生成目录。

0 commit comments

Comments
 (0)