docs(Lazyload): update lazy component guide (#4442)

This commit is contained in:
neverland 2019-09-12 15:57:40 +08:00 committed by GitHub
parent e359ed6ace
commit f14043c18d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -40,6 +40,13 @@ Use `v-lazy:background-image` to set background url, and declare the height of t
### Lazyload Component
```js
// set `lazyComponent` option
Vue.use(Lazyload, {
lazyComponent: true
});
```
```html
<lazy-component>
<img v-for="img in imageList" v-lazy="img" >
@ -61,4 +68,4 @@ Use `v-lazy:background-image` to set background url, and declare the height of t
| filter | The image's listener filter | *object* | - | - |
| lazyComponent | Lazyload component | *boolean* | `false` | - |
See more[ vue-lazyload ](https://github.com/hilongjw/vue-lazyload)
> See more[ vue-lazyload ](https://github.com/hilongjw/vue-lazyload)

View File

@ -43,9 +43,16 @@ export default {
<div v-for="img in imageList" v-lazy:background-image="img" />
```
### 懒加载模块
### 组件懒加载
懒加载模块需要使用到`lazy-component`,将需要懒加载的内容放在`lazy-component`中即可。
将需要懒加载的组件放在`lazy-component`标签中,即可实现组件懒加载。
```js
// 注册时设置`lazyComponent`选项
Vue.use(Lazyload, {
lazyComponent: true
});
```
```html
<lazy-component>
@ -68,4 +75,4 @@ export default {
| filter | 图片 URL 过滤 | *object* | - | - |
| lazyComponent | 是否能懒加载模块 | *boolean* | `false` | - |
更多内容请参照:[vue-lazyload 官方文档](https://github.com/hilongjw/vue-lazyload)
> 更多内容请参照:[vue-lazyload 官方文档](https://github.com/hilongjw/vue-lazyload)