Skip to content

Commit 5894ba3

Browse files
committed
docs: add en and zh guide page
1 parent 4ee38de commit 5894ba3

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

docs/.vuepress/config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ module.exports = {
1717
selectText: 'Languages',
1818
label: 'English',
1919
nav: [],
20+
sidebar: {
21+
'/guide/': [
22+
'',
23+
],
24+
},
2025
footer: `
2126
<p>
2227
Released under the
@@ -36,6 +41,11 @@ module.exports = {
3641
selectText: '选择语言',
3742
label: '简体中文',
3843
nav: [],
44+
sidebar: {
45+
'/zh/guide/': [
46+
'',
47+
],
48+
},
3949
footer: `
4050
<p>
4151
遵循

docs/guide/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Guide
2+
3+
## Installation
4+
5+
### NPM
6+
7+
If you are building big application now, recommend you use the way.
8+
9+
``` bash
10+
npm install vue-infinite-loading -S
11+
```
12+
13+
### Direct `<script>` Include
14+
15+
After you imported this plugin through `script` tag, it will register `InfiniteLoading` component automatically, so you can use it in globally.
16+
17+
#### CDN
18+
19+
You can import this plugin from [unpkg](https://unpkg.com):
20+
21+
``` html
22+
<script src="https://unpkg.com/[email protected]/dist/vue-infinite-loading.js"></script>
23+
```
24+
25+
#### Manual
26+
27+
You also can download and import it manually:
28+
29+
<a target="_blank" href="https://github.com/PeachScript/vue-infinite-loading/raw/master/dist/vue-infinite-loading.js" class="button button-small button-basic">Download</a>
30+
31+
## Import
32+
33+
### Component
34+
35+
You can import it as a custom component:
36+
37+
``` vue
38+
<template>
39+
<infinite-loading></infinite-loading>
40+
</template>
41+
42+
<script>
43+
import InfiniteLoading from 'vue-infinite-loading';
44+
45+
export default {
46+
components: {
47+
InfiniteLoading,
48+
},
49+
};
50+
</script>
51+
```
52+
53+
### Plugin API
54+
55+
If you want to configure default options, you can register this plugin through `use` API of Vue.js:
56+
57+
``` js
58+
// main.js or index.js
59+
import InfiniteLoading from 'vue-infinite-loading;
60+
61+
Vue.use(InfiniteLoading, { /* options */ });
62+
```
63+
64+
Same as the `script` include way, the `InfiniteLoading` component will be registered as a global comopnent if use the plugin API, you don't need to re-register it through `components` property in your own components.

docs/zh/guide/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 指南
2+
3+
## 安装插件
4+
5+
### NPM
6+
7+
推荐在构建大型应用的时候使用这种方式进行安装。
8+
9+
``` bash
10+
npm install vue-infinite-loading -S
11+
```
12+
13+
### 直接使用 `<script>` 引入
14+
15+
在使用 `script` 标签引入此插件后,`InfiniteLoading` 组件会被自动注册到全局,开发时直接进行使用即可。
16+
17+
#### CDN
18+
19+
你可以借助 [unpkg](https://unpkg.com) 引入此插件:
20+
21+
``` html
22+
<script src="https://unpkg.com/[email protected]/dist/vue-infinite-loading.js"></script>
23+
```
24+
25+
#### 手动引入
26+
27+
你也可以下载插件文件后手动引入:
28+
29+
<a target="_blank" href="https://github.com/PeachScript/vue-infinite-loading/raw/master/dist/vue-infinite-loading.js" class="button button-small button-basic">下载插件</a>
30+
31+
## 引用插件
32+
33+
### 组件形式
34+
35+
你可以直接将它当做一个自定义组件进行引用:
36+
37+
``` vue
38+
<template>
39+
<infinite-loading></infinite-loading>
40+
</template>
41+
42+
<script>
43+
import InfiniteLoading from 'vue-infinite-loading';
44+
45+
export default {
46+
components: {
47+
InfiniteLoading,
48+
},
49+
};
50+
</script>
51+
```
52+
53+
### 插件 API
54+
55+
如果你需要改变插件的默认配置,那么可以采用 Vue.js 提供的 `use` API 对此插件进行注册:
56+
57+
``` js
58+
// main.js or index.js
59+
import InfiniteLoading from 'vue-infinite-loading;
60+
61+
Vue.use(InfiniteLoading, { /* 配置 */ });
62+
```
63+
64+
和 `script` 引入方式一样,使用插件 API 也会将 `InfiniteLoading` 组件注册为全局组件,在你自己的组件中就无需再使用 `components` 属性重复注册了。

0 commit comments

Comments
 (0)