8000 docs: add en and zh configure plugin page · PeachScript/vue-infinite-loading@5587028 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 5587028

Browse files
committed
docs: add en and zh configure plugin page
1 parent 316b349 commit 5587028

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

docs/.vuepress/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = {
3131
'',
3232
'start-with-hn',
3333
'use-with-filter-or-tabs',
34+
'configure-plugin-opts',
3435
],
3536
},
3637
footer: `
@@ -66,6 +67,7 @@ module.exports = {
6667
'',
6768
'start-with-hn',
6869
'use-with-filter-or-tabs',
70+
'configure-plugin-opts',
6971
],
7072
},
7173
footer: `

docs/guide/configure-plugin-opts.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Configure Plugin Options
2+
3+
We can configure default properties, default slots and default system settings for this plugin via the plugin API, they will apply for all the `InfiniteLoading` components in your project.
4+
5+
## Props/Settings
6+
7+
Simply passing a object contains `props`/`settings` filed to configure them, to check out all available options, click [here](../api/#options).
8+
9+
``` js
10+
import Vue from 'vue';
11+
import InfiniteLoading from 'vue-infinite-loading';
12+
13+
Vue.use(InfiniteLoading, {
14+
props: {
15+
spinner: 'default',
16+
/* other props need to configure */
17+
},
18+
system: {
19+
throttleLimit: 50,
20+
/* other settings need to configure */
21+
},
22+
});
23+
```
24+
25+
## Slots
26+
27+
Unlike properties and settings, slot option can be a string or a `Vue Component`:
28+
29+
``` js
30+
import Vue from 'vue';
31+
import InfiniteLoading from 'vue-infinite-loading';
32+
import InfiniteError from 'path/to/your/components/InfiniteError';
33+
34+
Vue.use(InfiniteLoading, {
35+
slots: {
36+
noMore: 'No more message', // you can pass a string value
37+
error: InfiniteError, // you also can pass a Vue component as a slot
38+
},
39+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# 配置插件选项
2+
3+
我们可以通过插件 API 配置该插件的默认属性、默认插槽以及默认系统配置,它们会被应用到你项目中的所有 `InfiniteLoading` 组件上。
4+
5+
## 属性/设置
6+
7+
只需要传递一个包含 `props`/`settings` 字段的对象就可以配置它们了,点击[这里](../api/#选项)查看所有可用的选项。
8+
9+
``` js
10+
import Vue from 'vue';
11+
import InfiniteLoading from 'vue-infinite-loading';
12+
13+
Vue.use(InfiniteLoading, {
14+
props: {
15+
spinner: 'default',
16+
/* other props need to configure */
17+
},
18+
system: {
19+
throttleLimit: 50,
20+
/* other settings need to configure */
21+
},
22+
});
23+
```
24+
25+
## 插槽
26+
27+
和属性及配置不一样,插槽选项可以是一个字符串,也可以是一个 `Vue Component`
28+
29+
``` js
30+
import Vue from 'vue';
31+
import InfiniteLoading from 'vue-infinite-loading';
32+
import InfiniteError from 'path/to/your/components/InfiniteError';
33+
34+
Vue.use(InfiniteLoading, {
35+
slots: {
36+
noMore: 'No more message', // you can pass a string value
37+
error: InfiniteError, // you also can pass a Vue component as a slot
38+
},
39+
});

0 commit comments

Comments
 (0)
0