docs: update component registration guide

This commit is contained in:
chenjiahan
2020-08-20 23:32:07 +08:00
parent 9a86e9e6ca
commit d42b1b43c3
124 changed files with 450 additions and 303 deletions
+5 -4
View File
@@ -3,13 +3,14 @@
### Install
```js
import Vue from 'vue';
import { createApp } from 'vue';
import { Lazyload } from 'vant';
Vue.use(Lazyload);
const app = createApp();
app.use(Lazyload);
// with options
Vue.use(Lazyload, {
app.use(Lazyload, {
lazyComponent: true,
});
```
@@ -47,7 +48,7 @@ Use `v-lazy:background-image` to set background url, and declare the height of t
```js
// set `lazyComponent` option
Vue.use(Lazyload, {
app.use(Lazyload, {
lazyComponent: true,
});
```
+5 -4
View File
@@ -5,13 +5,14 @@
`Lazyload``Vue` 指令,使用前需要对指令进行注册
```js
import Vue from 'vue';
import { createApp } from 'vue';
import { Lazyload } from 'vant';
Vue.use(Lazyload);
const app = createApp();
app.use(Lazyload);
// 注册时可以配置额外的选项
Vue.use(Lazyload, {
app.use(Lazyload, {
lazyComponent: true,
});
```
@@ -53,7 +54,7 @@ export default {
```js
// 注册时设置`lazyComponent`选项
Vue.use(Lazyload, {
app.use(Lazyload, {
lazyComponent: true,
});
```