vue下载流文件
作者:
蜗牛的学习方法 | 来源:发表于
2023-12-19 18:04 被阅读0次export function getStreamFile(res, fileName) {
const { data } = res;
console.log(data);
const blob = new Blob([data]);
let elink = document.createElement("a");
elink.download = fileName || "filename";
elink.style.display = "none";
let href = window.URL.createObjectURL(blob);
elink.href = href;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
window.URL.revokeObjectURL(href); // 释放掉blob对象
}
本文标题:vue下载流文件
本文链接:https://www.haomeiwen.com/subject/nlozgdtx.html
网友评论