Skip to content

Commit fd51d43

Browse files
committed
docs: update plugin & nav
1 parent 77ef9ae commit fd51d43

File tree

4 files changed

+42
-26
lines changed

4 files changed

+42
-26
lines changed

packages/docs/docs/.vuepress/nav/en.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ module.exports = [
1919
link: '/plugin/#using-a-plugin'
2020
},
2121
{
22-
text: 'Options',
23-
link: '/plugin/#options'
22+
text: 'Life Cycle API',
23+
link: '/plugin/#life-cycle-api'
24+
},
25+
{
26+
text: 'Option API',
27+
link: '/plugin/#option-api'
28+
},
29+
{
30+
text: 'Context API',
31+
link: '/plugin/#context-api'
2432
},
2533
{
2634
text: 'Official Plugins',

packages/docs/docs/.vuepress/nav/zh.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,24 @@ module.exports = [
1111
text: '插件',
1212
items: [
1313
{
14-
text: '插件的开发',
14+
text: '开发插件',
1515
link: '/zh/plugin/#writing-a-plugin'
1616
},
1717
{
18-
text: '插件的使用',
18+
text: '使用插件',
1919
link: '/zh/plugin/#using-a-plugin'
2020
},
2121
{
22-
text: '插件的选项',
23-
link: '/zh/plugin/#options'
22+
text: '生命周期',
23+
link: '/zh/plugin/#life-cycle-api'
24+
},
25+
{
26+
text: 'Option API',
27+
link: '/zh/plugin/#option-api'
28+
},
29+
{
30+
text: 'Context API',
31+
link: '/zh/plugin/#context-api'
2432
},
2533
{
2634
text: '官方插件',

packages/docs/docs/plugin/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar: auto
33
---
44

5-
# Plugins
5+
# Plugin
66

77
Plugins usually add global-level functionality to VuePress. There is no strictly defined scope for a plugin - there are typically several types of plugins:
88

@@ -151,7 +151,7 @@ module.exports = {
151151

152152
:::
153153

154-
## Life Cycle
154+
## Life Cycle API
155155

156156
### ready
157157

@@ -201,7 +201,7 @@ module.exports = {
201201
}
202202
```
203203

204-
## API
204+
## Option API
205205

206206
### name
207207

@@ -653,12 +653,12 @@ Then, VuePress will automatically inject these components behind the layout comp
653653
</div>
654654
```
655655

656-
## ctx
656+
## Context API
657657

658658
Starting with VuePress 1.x.x, VuePress provides an `AppContext` object that stores all the state of the current app and can be accessed through the plugin API.
659659

660660
::: warning Note
661-
Context of each plugin is a isolated context, they just inherit from the same app context.
661+
Context of each plugin is a isolated context inherited from the same app context.
662662
:::
663663

664664
```js
@@ -671,7 +671,7 @@ module.exports = (options, ctx) => {
671671

672672
- Type: `boolean`
673673

674-
Whether vuepress run in production environment mode.
674+
Whether VuePress run in production environment mode.
675675

676676
### ctx.sourceDir
677677

packages/docs/docs/zh/plugin/README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module.exports = {
201201
}
202202
```
203203

204-
## API
204+
## Option API
205205

206206
### name
207207

@@ -651,12 +651,12 @@ VuePress 将会自动将这些组件注入到布局组件的隔壁:
651651
</div>
652652
```
653653

654-
## ctx
654+
## Context API
655655

656-
Starting with VuePress 1.x.x, VuePress provides an `AppContext` object that stores all the state of the current app and can be accessed through the plugin API.
656+
VuePress 提供了一个存储了当前页面所有状态的 Context API
657657

658-
::: warning Note
659-
Context of each plugin is a isolated context, they just inherit from the same app context.
658+
::: tip 提示
659+
每个函数式插件的上下文对象是一个继承于根上下文的隔离上下文对象。
660660
:::
661661

662662
```js
@@ -667,42 +667,42 @@ module.exports = (options, ctx) => {
667667

668668
### ctx.isProd
669669

670-
- Type: `boolean`
670+
- 类型: `boolean`
671671

672-
Whether vuepress run in production environment mode.
672+
VuePress 是否运行在生产环境模式下。
673673

674674
### ctx.sourceDir
675675

676-
- Type: `string`
676+
- 类型: `string`
677677

678-
Root directory where the documents are located.
678+
文档的根目录路径。
679679

680680
### ctx.tempPath
681681

682682
- Type: `string`
683683

684-
Root directory where the temporary files are located.
684+
临时文件所在的根目录路径。
685685

686686
### ctx.outDir
687687

688688
- Type: `string`
689689

690-
Output path.
690+
输出目录。
691691

692692
### ctx.themePath
693693

694694
- Type: `string`
695695

696-
The path of the currently active theme.
696+
当前应用的主题的根路径。
697697

698698
### ctx.base
699699

700700
- Type: `string`
701701

702-
See: [base](../config/README.md#base).
702+
参考: [base](../config/README.md#base).
703703

704704
### ctx.writeTemp
705705

706706
- Type: `Function`
707707

708-
A utility for writing temporary files to tempPath.
708+
一个用于向 tempPath 写入临时文件的方法。

0 commit comments

Comments
 (0)