有時候需要知道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)