js下载base64图片

let base64Str = "data:image/jpeg;base64,"+base64;
let aLink = document.createElement("a");
aLink.style.display = "none";
aLink.href = base64Str;
aLink.download = "test.jpg";
// 触发点击-然后移除
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink);

你可能感兴趣的:(休闲,js)