Skip to content

Commit 17a03f2

Browse files
committed
docs: migrate register-components
1 parent efece12 commit 17a03f2

File tree

4 files changed

+141
-50
lines changed

4 files changed

+141
-50
lines changed

packages/@vuepress/plugin-register-components/README.md

-50
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,3 @@
22

33
> register-components plugin for vuepress
44
5-
## Plugin Options
6-
7-
### componentsDir
8-
9-
- Type: `Array | String`
10-
- Default: `[]`
11-
12-
All components in this directory will be registered as global components, naming of components will follow the components found in [.vuepress/components](https://vuepress.vuejs.org/guide/using-vue.html#using-components).
13-
14-
- Usage:
15-
16-
``` js
17-
module.exports = {
18-
plugins: [
19-
[
20-
'register-components',
21-
{
22-
componentsDir: somepath
23-
}
24-
]
25-
]
26-
}
27-
```
28-
29-
### components
30-
31-
- Type: `{ name: string, path: string }`
32-
- Default: `[]`
33-
34-
Register global components by explicit name and path.
35-
36-
- Usage:
37-
38-
``` js
39-
module.exports = {
40-
plugins: [
41-
[
42-
'register-components',
43-
{
44-
components: [
45-
{
46-
name: 'V-Card',
47-
path: 'path/to/card.vue'
48-
}
49-
]
50-
}
51-
]
52-
]
53-
}
54-
```

packages/docs/docs/.vuepress/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ function getPluginSidebar (pluginTitle, pluginIntro, officialPluginTitle) {
146146
'official/plugin-last-updated',
147147
'official/plugin-medium-zoom',
148148
'official/plugin-back-to-top',
149+
'official/plugin-register-components',
149150
]
150151
}
151152
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: register-components
3+
metaTitle: Register Components Plugin | VuePress
4+
---
5+
6+
# [@vuepress/plugin-register-components](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-register-components)
7+
8+
> register-components plugin for vuepress
9+
10+
## Install
11+
12+
```bash
13+
yarn add -D @vuepress/plugin-register-components
14+
# OR npm install -D @vuepress/plugin-register-components
15+
```
16+
17+
## Usage
18+
19+
```javascript
20+
module.exports = {
21+
plugins: ['@vuepress/register-components']
22+
}
23+
```
24+
25+
## Options
26+
27+
### componentsDir
28+
29+
- Type: `Array | String`
30+
- Default: `[]`
31+
32+
All components in this directory will be registered as global components, naming of components will follow the components found in [.vuepress/components](https://vuepress.vuejs.org/guide/using-vue.html#using-components).
33+
34+
``` js
35+
module.exports = {
36+
plugins: [
37+
[
38+
'register-components',
39+
{
40+
componentsDir: somepath
41+
}
42+
]
43+
]
44+
}
45+
```
46+
47+
### components
48+
49+
- Type: `{ name: string, path: string }`
50+
- Default: `[]`
51+
52+
Register global components by explicit name and path.
53+
54+
``` js
55+
module.exports = {
56+
plugins: [
57+
[
58+
'register-components',
59+
{
60+
components: [
61+
{
62+
name: 'V-Card',
63+
path: 'path/to/card.vue'
64+
}
65+
]
66+
}
67+
]
68+
]
69+
}
70+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: register-components
3+
metaTitle: 注册组件的插件 | VuePress
4+
---
5+
6+
# [@vuepress/plugin-register-components](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-register-components)
7+
8+
> register-components plugin for vuepress
9+
10+
## 安装
11+
12+
```bash
13+
yarn add -D @vuepress/plugin-register-components
14+
# OR npm install -D @vuepress/plugin-register-components
15+
```
16+
17+
## 使用
18+
19+
```javascript
20+
module.exports = {
21+
plugins: ['@vuepress/register-components']
22+
}
23+
```
24+
25+
## 选项
26+
27+
### componentsDir
28+
29+
- 类型: `Array | String`
30+
- 默认值: `[]`
31+
32+
在这个目录下的所有组件将会被注册为全局组件,组件的命名将遵循在 [.vuepress/components](https://vuepress.vuejs.org/guide/using-vue.html#using-components) 中找到的组件的命名。
33+
34+
``` js
35+
module.exports = {
36+
plugins: [
37+
[
38+
'register-components',
39+
{
40+
componentsDir: somepath
41+
}
42+
]
43+
]
44+
}
45+
```
46+
47+
### components
48+
49+
- 类型: `{ name: string, path: string }`
50+
- 默认值: `[]`
51+
52+
通过明确的名称和路径来注册组件。
53+
54+
``` js
55+
module.exports = {
56+
plugins: [
57+
[
58+
'register-components',
59+
{
60+
components: [
61+
{
62+
name: 'V-Card',
63+
path: 'path/to/card.vue'
64+
}
65+
]
66+
}
67+
]
68+
]
69+
}
70+
```

0 commit comments

Comments
 (0)