const errorImg ='base64字符串'; //因为base64字符串较长所以简写
window.addEventListener(
"error",
function (event) {
const target = event.target;
if (target instanceof HTMLImageElement) {
target.src = errorImg;
console.log("图片加载异常", target);
}
},
true
);
网友评论