分享一个精简的vue.js 图片lazyload插件实例
发布时间:2020-12-17 03:02:15 所属栏目:百科 来源:网络整理
导读:这个插件未压缩版本只有7.62kb,很精简,支持img标签和background-img资源的lazyload。支持vue.js 1.0 和vue.js 2.0 安转 使用方法 import Vue from 'vue' // import VueLazyload import VueLazyload from 'vue-lazyload' //use custom directive Vue.use(Vu
这个插件未压缩版本只有7.62kb,很精简,支持img标签和background-img资源的lazyload。支持vue.js 1.0 和vue.js 2.0 安转使用方法import Vue from 'vue'
// import VueLazyload import VueLazyload from 'vue-lazyload' //use custom directive // use options new Vue({ 这里可以定制所有加载中和加载失败加载成功的样式,
img[lazy=loading] {
/*your style here*/
}
img[lazy=error] {
/*your style here*/
},img[lazy=loaded] {
/*your style here*/
}
/*
or background-image
*/
.yourclass[lazy=loading] {
/*your style here*/
}
.yourclass[lazy=error] {
/*your style here*/
},.yourclass[lazy=loaded] {
/*your style here*/
}
APIOptions
demo下载地址: 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读