//下载图片
const downloadImg = () =>{
fetch(imgUrl)//
.then((response) => response.blob())
.then((blob) => {
const url = URL.createObjectURL(new Blob([blob]));
const link = document.createElement('a');
link.href = url;
link.download ='认证资料.png';
document.body.appendChild(link);
link.click();
URL.revokeObjectURL(url);
link.remove();
});
}
a标签下载图片的方式之一,已有图片地址
最新推荐文章于 2024-05-10 13:10:12 发布