usage
import Vue from 'vue'import VueLazyload from 'vue-lazyload'Vue.use(VueLazyload, { preLoad: 1.3, error: 'dist/error.png', loading: 'dist/loading.gif', attempt: 1})
登录后复制
Options
参数说明
preLoad
描述:
例子:
error
立即学习“前端免费学习笔记(深入)”;
描述:图片加载失败后,的默认图片
例子:error: ‘dist/error.png’,
loading
描述:图片加载过程中,默认显示的图片设置
例子: loading: ‘dist/loading.gif’,
attempt
描述:
例子:
listenEvents
描述:监听的事件,默认值 [‘scroll’, ‘wheel’, ‘mousewheel’, ‘resize’, ‘animationend’, ‘transitionend’, ‘touchmove’]
例子:listenEvents: [ ‘scroll’ ]
adapter
描述:
例子:
filter
描述:过滤图片的路径,默认{ }
例子:
lazyComponent
描述:
例子:
实战例子
在main.js文件添加:import VueLazyload from 'vue-lazyload'Vue.use(VueLazyload, { // 设置默认显示的图片 loading: require('common/image/default.png')})在需要用到延迟加载页面@@##@@
以上就是vue-lazyload – 图片延迟加载实例教程的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/3197296.html