有时候需要知道vue-lazyload加载完毕后,做一些操作,比如获取图片的总高度等等,
使用 this.$Lazyload.$on('loaded', handler) 方法
let self = this ,this 为vue实例
function handler ({ el, src }, formCache) {
var wrapperHeight = document.documentElement.clientHeight;
var wrapper= document.getElementById('wrapper').clientHeight;
if(wrapper>wrapperHeight){
self.display=true;
}else{
self.display=false;
}
}
// 监听Lazyload图片加载完毕,获取图片高度
this.$Lazyload.$on('loaded', handler)