11.vue-lazyload(图片懒加载)
简介:Vue module for lazyloading images in your applications. Some of goals of this project worth noting include:
- Be lightweight, powerful and easy to use
- Work on any image type
- Add loading class while image is loading
- Supports both of Vue 1.0 and Vue 2.0
安装
1
npm i vue-lazyload --save
导入(main.js)
1
import VueLazyLoad from 'vue-lazyload'
使用(相关配置项可以到官网查看)
1
2
3
4//图片懒加载
Vue.use(VueLazyLoad, {
loading: require('./assets/img/common/placeholder.png')
})
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Dong!
评论