let imageAsync=(url)=>{
return new Promise((resolve,reject)=>{
let img=new Image();
img.src=url;
img.onload=()=>{
resolve(image)
}
img.onerror=(err)=>{
reject(err)
}
})
}
imageAsync("url").then(()=>{
console.log('加载成功')
}).catch((error)=>{
console.log('加载失败')
})