Closed pengcheng933 closed 2 years ago
const w=listener.naturalWidth; const h=listener.naturalHeight; console.log(w,h); if(w>h){ listener.el.style.height=111/36+'rem'; }else{ listener.el.style.width=111/36+'rem'; }
因为组件中对于缓存图片不会再给值,只需要再loaded中将缓存删除掉
loaded(listener) { listener._imageCache._caches=listener._imageCache._caches.filter(item=>item===listener.el.src) },
const w=listener.naturalWidth; const h=listener.naturalHeight; console.log(w,h); if(w>h){ listener.el.style.height=111/36+'rem'; }else{ listener.el.style.width=111/36+'rem'; }