Skip to content

Commit 9761a9b

Browse files
committed
docs: update built-in components reference
1 parent 5531047 commit 9761a9b

File tree

8 files changed

+91
-57
lines changed

8 files changed

+91
-57
lines changed

docs/guide/markdown.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ Take our documentation source files as an example:
6767

6868
```vue
6969
<template>
70-
<RouterLink to="/">Home</RouterLink>
71-
<RouterLink to="/reference/config.html">Config Reference</RouterLink>
72-
<RouterLink to="/guide/getting-started.html">Getting Started</RouterLink>
73-
<RouterLink to="/guide/introduction.html">Guide &gt; Introduction</RouterLink>
74-
<RouterLink to="/reference/config.html#links">
70+
<RouteLink to="/">Home</RouteLink>
71+
<RouteLink to="/reference/config.html">Config Reference</RouteLink>
72+
<RouteLink to="/guide/getting-started.html">Getting Started</RouteLink>
73+
<RouteLink to="/guide/introduction.html">Guide &gt; Introduction</RouteLink>
74+
<RouteLink to="/reference/config.html#links">
7575
Config Reference &gt; markdown.links
76-
</RouterLink>
76+
</RouteLink>
7777
<a href="https://github.com" target="_blank" rel="noopener noreferrer">
7878
GitHub
7979
</a>
@@ -91,7 +91,7 @@ Take our documentation source files as an example:
9191

9292
**Explanation**
9393

94-
- Internal links will be converted to `<RouterLink>` for SPA navigation.
94+
- Internal links will be converted to [RouteLink](../reference/components.md#routelink) for SPA navigation.
9595
- Internal links to `.md` files will be converted to the [page route path](./page.md#routing), and both absolute path and relative path are supported.
9696
- External links will get `target="_blank" rel="noopener noreferrer"` attrs.
9797

docs/reference/components.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,54 @@
2525

2626
- Props:
2727

28-
- pageKey
28+
- path
2929
- Type: `string`
3030
- Required: `false`
3131

3232
- Usage:
3333

3434
```md
35-
<Content page-key="v-xxxxxx" />
35+
<Content path="/path/to/page.md" />
3636
```
3737

3838
- Details:
3939

4040
This component will render the Markdown content of a page.
4141

42-
The page key is the [name](https://router.vuejs.org/api/#name-2) of the page route. If the `pageKey` prop is not provided, it will render the page of current route.
42+
If the `path` prop is not provided, it will render the page content of current route.
4343

4444
This component is mainly for developing themes. You won't need it in most cases.
4545

4646
- Also see:
47-
- [Node API > Page Properties > key](./node-api.md#key)
47+
- [Node API > Page Properties > path](./node-api.md#path)
48+
49+
## RouteLink
50+
51+
- Props:
52+
53+
- to
54+
- Type: `string`
55+
- Required: `true`
56+
- active
57+
- Type: `boolean`
58+
- Required: `false`
59+
- Default: `false`
60+
- activeClass
61+
- Type: `string`
62+
- Required: `false`
63+
- Default: `'route-link-active'`
64+
65+
- Usage:
66+
67+
```md
68+
<RouteLink to="/path/to/target-page.md">target page</RouteLink>
69+
<RouteLink active to="/path/to/current-page.md">current page</RouteLink>
70+
```
71+
72+
- Details:
73+
74+
This component will render a link to the target page.
75+
76+
If the `active` prop is set to `true`, the link will have an extra `activeClass`. Notice that the active status won't be updated automatically when the route changes.
77+
78+
This component is mainly for developing themes. You won't need it in most cases. For theme authors, it's recommended to use this component instead of the `<RouterLink>` component from `vue-router`.

docs/reference/config.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ const defaultOptions = {
586586

587587
Options for VuePress built-in markdown-it links plugin.
588588

589-
It will convert internal links to `<RouterLink>`, and add extra attributes and icon to external links.
589+
It will convert the tag of internal links to [internalTag](#markdownlinksinternaltag), and add extra attributes and icon to external links.
590590

591591
Set to `false` to disable this plugin.
592592

@@ -595,15 +595,15 @@ const defaultOptions = {
595595

596596
#### markdown.links.internalTag
597597

598-
- Type: `'a' | 'RouterLink'`
598+
- Type: `'a' | 'RouteLink' | 'RouterLink'`
599599

600-
- Default: `'RouterLink'`
600+
- Default: `'RouteLink'`
601601

602602
- Details:
603603

604604
Tag for internal links.
605605

606-
By default, this plugin will transform internal links to `<RouterLink>`. You can set this option to `'a'` to disable this feature.
606+
By default, this plugin will transform internal links to [RouteLink](./components.md#routelink).
607607

608608
#### markdown.links.externalAttrs
609609

docs/reference/node-api.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,6 @@ Hello, world.
365365

366366
## Page Properties
367367

368-
### key
369-
370-
- Type: `string`
371-
372-
- Details:
373-
374-
Identifier of the page.
375-
376-
The page key would be used as the [name](https://router.vuejs.org/api/#name-2) of the page route.
377-
378-
- Also see:
379-
- [Built-in Components > Content](./components.md#content)
380-
381368
### path
382369

383370
- Type: `string`
@@ -454,7 +441,6 @@ interface PageHeader {
454441

455442
```ts
456443
interface PageData {
457-
key: string
458444
path: string
459445
title: string
460446
lang: string

docs/zh/guide/markdown.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
6868

6969
```vue
7070
<template>
71-
<RouterLink to="/zh/">首页</RouterLink>
72-
<RouterLink to="/zh/reference/config.html">配置参考</RouterLink>
73-
<RouterLink to="/zh/guide/getting-started.html">快速上手</RouterLink>
74-
<RouterLink to="/zh/guide/introduction.html">指南 &gt; 介绍</RouterLink>
75-
<RouterLink to="/zh/reference/config.html#links">
71+
<RouteLink to="/zh/">首页</RouteLink>
72+
<RouteLink to="/zh/reference/config.html">配置参考</RouteLink>
73+
<RouteLink to="/zh/guide/getting-started.html">快速上手</RouteLink>
74+
<RouteLink to="/zh/guide/introduction.html">指南 &gt; 介绍</RouteLink>
75+
<RouteLink to="/zh/reference/config.html#links">
7676
配置参考 &gt; markdown.links
77-
</RouterLink>
77+
</RouteLink>
7878
<a href="https://github.com" target="_blank" rel="noopener noreferrer">
7979
GitHub
8080
</a>
@@ -92,7 +92,7 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
9292

9393
**解释**
9494

95-
- 内部链接会被转换为 `<RouterLink>` 以便进行 SPA 导航。
95+
- 内部链接会被转换为 [RouteLink](../reference/components.md#routelink) 以便进行 SPA 导航。
9696
- 指向 `.md` 文件的内部链接会被转换为目标页面的 [路由路径](./page.md#路由),并且支持绝对路径和相对路径。
9797
- 外部链接会被添加 `target="_blank" rel="noopener noreferrer"` 属性。
9898

docs/zh/reference/components.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,54 @@
2525

2626
- Props:
2727

28-
- pageKey
28+
- path
2929
- 类型: `string`
3030
- 是否必须: `false`
3131

3232
- 使用:
3333

3434
```md
35-
<Content page-key="v-xxxxxx" />
35+
<Content path="/path/to/page.md" />
3636
```
3737

3838
- 详情:
3939

4040
该组件会渲染页面的 Markdown 内容。
4141

42-
页面 Key 是页面路由的 [name](https://router.vuejs.org/zh/api/#name-2)如果没有传入 `pageKey` Prop ,它会渲染当前路由下的页面
42+
如果没有传入 `path` Prop ,它会渲染当前路由下的页面内容
4343

4444
该组件主要是为了开发主题时使用。在绝大多数情况下你不会用到它。
4545

4646
- 参考:
47-
- [Node API > Page 属性 > key](./node-api.md#key)
47+
- [Node API > Page 属性 > path](./node-api.md#path)
48+
49+
## RouteLink
50+
51+
- Props:
52+
53+
- to
54+
- 类型: `string`
55+
- 是否必须: `true`
56+
- active
57+
- 类型: `boolean`
58+
- 是否必须: `false`
59+
- 默认值: `false`
60+
- activeClass
61+
- 类型: `string`
62+
- 是否必须: `false`
63+
- 默认值: `'route-link-active'`
64+
65+
- 使用:
66+
67+
```md
68+
<RouteLink to="/path/to/target-page.md">目标页面</RouteLink>
69+
<RouteLink active to="/path/to/current-page.md">当前页面</RouteLink>
70+
```
71+
72+
- 详情:
73+
74+
该组件会渲染一个链接,用于跳转到指定页面。
75+
76+
如果 `active` Prop 被设置为 `true` ,那么这个链接会被额外添加一个 `activeClass` 类名。需要注意的是,这里的 active 状态并不会根据当前路由自动更新。
77+
78+
该组件主要是为了开发主题时使用。在绝大多数情况下你不会用到它。对于主题作者来说,我们建议你尽可能使用这个组件,而不是使用 `vue-router``<RouterLink>` 组件。

docs/zh/reference/config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ const defaultOptions = {
599599

600600
VuePress 内置的 markdown-it 链接插件的配置项。
601601

602-
它可以把站内链接转换为 `<RouterLink>` ,并且可以在站外链接上添加额外的属性和图标。
602+
它可以把站内链接的 tag 转换为 [internalTag](#markdownlinksinternaltag) ,并且可以在站外链接上添加额外的属性和图标。
603603

604604
设置为 `false` 可以禁用该插件。
605605

@@ -610,13 +610,13 @@ const defaultOptions = {
610610

611611
- 类型: `string`
612612

613-
- 默认值: `'RouterLink'`
613+
- 默认值: `'RouteLink'`
614614

615615
- 详情:
616616

617617
内部链接所使用的标签。
618618

619-
默认情况下,该插件会把内部链接转换为 `<RouterLink>` 。你可以把该选项设置为 `'a'` 来禁用这个功能
619+
默认情况下,该插件会把内部链接转换为 [RouteLink](./components.md#routelink)
620620

621621
#### markdown.links.externalAttrs
622622

docs/zh/reference/node-api.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -363,19 +363,6 @@ export default {
363363

364364
## Page 属性
365365

366-
### key
367-
368-
- 类型: `string`
369-
370-
- 详情:
371-
372-
该 Page 的标识。
373-
374-
Page Key 会被用作页面路由的 [name](https://router.vuejs.org/api/#name-2)
375-
376-
- 参考:
377-
- [Built-in Components > Content](./components.md#content)
378-
379366
### path
380367

381368
- 类型: `string`
@@ -452,7 +439,6 @@ interface PageHeader {
452439

453440
```ts
454441
interface PageData {
455-
key: string
456442
path: string
457443
title: string
458444
lang: string

0 commit comments

Comments
 (0)