html解决方案

234 阅读1分钟

img

图片加载的方法,加载成功和加载失败方法

      const img = new Image()  
      const _this = this     
     // 图片加载成功      
     img.onload = el => {}      
     // 图片加载失败      
     img.onerror = el => {   
     }      
     img.src = url