downloadBlob(response) {
// response 是接口返回流
let blob = new Blob([response], {
type: "application/msword;charset=UTF-8",
});
// let blob = new Blob([response], { type: 'application/pdf;chartset=UTF-8' })
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.style.display = "none";
link.href = url;
console.log("link.href", link.href);
link.download = `附件`;
document.body.appendChild(link);
link.click();
window.URL.revokeObjectURL(link.href); //释放url
document.body.removeChild(link); //释放标签
},
new Blob([response], {type: "application/msword;charset=UTF-8",});
按需修改
1万+

被折叠的 条评论
为什么被折叠?



