File tree Expand file tree Collapse file tree 8 files changed +91
-57
lines changed Expand file tree Collapse file tree 8 files changed +91
-57
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,13 @@ Take our documentation source files as an example:
67
67
68
68
``` vue
69
69
<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 > 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 > Introduction</RouteLink >
74
+ <RouteLink to="/reference/config.html#links">
75
75
Config Reference > markdown.links
76
- </RouterLink >
76
+ </RouteLink >
77
77
<a href="https://github.com" target="_blank" rel="noopener noreferrer">
78
78
GitHub
79
79
</a>
@@ -91,7 +91,7 @@ Take our documentation source files as an example:
91
91
92
92
** Explanation**
93
93
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.
95
95
- 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.
96
96
- External links will get ` target="_blank" rel="noopener noreferrer" ` attrs.
97
97
Original file line number Diff line number Diff line change 25
25
26
26
- Props:
27
27
28
- - pageKey
28
+ - path
29
29
- Type: ` string `
30
30
- Required: ` false `
31
31
32
32
- Usage:
33
33
34
34
``` md
35
- <Content page-key="v-xxxxxx " />
35
+ <Content path="/path/to/page.md " />
36
36
```
37
37
38
38
- Details:
39
39
40
40
This component will render the Markdown content of a page.
41
41
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.
43
43
44
44
This component is mainly for developing themes. You won't need it in most cases.
45
45
46
46
- 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 ` .
Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ const defaultOptions = {
586
586
587
587
Options for VuePress built-in markdown-it links plugin.
588
588
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.
590
590
591
591
Set to ` false ` to disable this plugin.
592
592
@@ -595,15 +595,15 @@ const defaultOptions = {
595
595
596
596
#### markdown.links.internalTag
597
597
598
- - Type: ` 'a' | 'RouterLink' `
598
+ - Type: ` 'a' | 'RouteLink' | ' RouterLink' `
599
599
600
- - Default: ` 'RouterLink ' `
600
+ - Default: ` 'RouteLink ' `
601
601
602
602
- Details:
603
603
604
604
Tag for internal links.
605
605
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 ) .
607
607
608
608
#### markdown.links.externalAttrs
609
609
Original file line number Diff line number Diff line change @@ -365,19 +365,6 @@ Hello, world.
365
365
366
366
## Page Properties
367
367
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
-
381
368
### path
382
369
383
370
- Type: ` string `
@@ -454,7 +441,6 @@ interface PageHeader {
454
441
455
442
``` ts
456
443
interface PageData {
457
- key: string
458
444
path: string
459
445
title: string
460
446
lang: string
Original file line number Diff line number Diff line change @@ -68,13 +68,13 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
68
68
69
69
``` vue
70
70
<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">指南 > 介绍</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">指南 > 介绍</RouteLink >
75
+ <RouteLink to="/zh/reference/config.html#links">
76
76
配置参考 > markdown.links
77
- </RouterLink >
77
+ </RouteLink >
78
78
<a href="https://github.com" target="_blank" rel="noopener noreferrer">
79
79
GitHub
80
80
</a>
@@ -92,7 +92,7 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
92
92
93
93
** 解释**
94
94
95
- - 内部链接会被转换为 ` <RouterLink> ` 以便进行 SPA 导航。
95
+ - 内部链接会被转换为 [ RouteLink ] ( ../reference/components.md#routelink ) 以便进行 SPA 导航。
96
96
- 指向 ` .md ` 文件的内部链接会被转换为目标页面的 [ 路由路径] ( ./page.md#路由 ) ,并且支持绝对路径和相对路径。
97
97
- 外部链接会被添加 ` target="_blank" rel="noopener noreferrer" ` 属性。
98
98
Original file line number Diff line number Diff line change 25
25
26
26
- Props:
27
27
28
- - pageKey
28
+ - path
29
29
- 类型: ` string `
30
30
- 是否必须: ` false `
31
31
32
32
- 使用:
33
33
34
34
``` md
35
- <Content page-key="v-xxxxxx " />
35
+ <Content path="/path/to/page.md " />
36
36
```
37
37
38
38
- 详情:
39
39
40
40
该组件会渲染页面的 Markdown 内容。
41
41
42
- 页面 Key 是页面路由的 [ name ] ( https://router.vuejs.org/zh/api/#name-2 ) 。 如果没有传入 ` pageKey ` Prop ,它会渲染当前路由下的页面 。
42
+ 如果没有传入 ` path ` Prop ,它会渲染当前路由下的页面内容 。
43
43
44
44
该组件主要是为了开发主题时使用。在绝大多数情况下你不会用到它。
45
45
46
46
- 参考:
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> ` 组件。
Original file line number Diff line number Diff line change @@ -599,7 +599,7 @@ const defaultOptions = {
599
599
600
600
VuePress 内置的 markdown-it 链接插件的配置项。
601
601
602
- 它可以把站内链接转换为 ` <RouterLink> ` ,并且可以在站外链接上添加额外的属性和图标。
602
+ 它可以把站内链接的 tag 转换为 [ internalTag ] ( #markdownlinksinternaltag ) ,并且可以在站外链接上添加额外的属性和图标。
603
603
604
604
设置为 ` false ` 可以禁用该插件。
605
605
@@ -610,13 +610,13 @@ const defaultOptions = {
610
610
611
611
- 类型: ` string `
612
612
613
- - 默认值: ` 'RouterLink ' `
613
+ - 默认值: ` 'RouteLink ' `
614
614
615
615
- 详情:
616
616
617
617
内部链接所使用的标签。
618
618
619
- 默认情况下,该插件会把内部链接转换为 ` <RouterLink> ` 。你可以把该选项设置为 ` 'a' ` 来禁用这个功能 。
619
+ 默认情况下,该插件会把内部链接转换为 [ RouteLink ] ( ./components.md#routelink ) 。
620
620
621
621
#### markdown.links.externalAttrs
622
622
Original file line number Diff line number Diff line change @@ -363,19 +363,6 @@ export default {
363
363
364
364
## Page 属性
365
365
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
-
379
366
### path
380
367
381
368
- 类型: ` string `
@@ -452,7 +439,6 @@ interface PageHeader {
452
439
453
440
``` ts
454
441
interface PageData {
455
- key: string
456
442
path: string
457
443
title: string
458
444
lang: string
You can’t perform that action at this time.
0 commit comments