答案:
function loadImgAsync(url) {
return new Promise(function(resolve, reject) {
var img = new Image()
img.onload = function() {
resolve(img)
}
img.onerror = function() {
reject(new Error('无法加载该路径图片' + url))
}
img.src = url
})
}