const content = ‘后台返回的二进制文件’;
const blob = new Blob([content]);
let url = window.URL.createObjectURL(blob);
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute(
"download",
res.headers["content-disposition"].split("=")[1]
);
document.body.appendChild(link);
link.click();
nuxt 实现文件下载(浏览器自动下载)
最新推荐文章于 2024-07-15 09:56:06 发布