mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-11-04 04:42:09 +08:00 
			
		
		
		
	docs(Lazyload): update lazy component guide (#4442)
This commit is contained in:
		
							parent
							
								
									e359ed6ace
								
							
						
					
					
						commit
						f14043c18d
					
				@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user