IE不支持a标签的download
可以使用IE自带的msSaveBlob方法
const fileNameEncode =
res.headers["content-disposition"].split("filename=")[1];
// 文件名 解码
const fileName = decodeURI(fileNameEncode);
console.log("fileName", fileName);
let blob = new Blob([res.data], {
type: "application/msword,charset=utf-8",
});
const blobUrl = window.URL.createObjectURL(blob);
if (window.navigator.msSaveBlob) {
//判断了有该方法即为IE浏览器
try {
window.navigator.msSaveBlob(blob, fileName);
} catch (e) {
console.log(e);
}
} else {
let link = document.createElement("a");
link.style.display = "none";
link.href = blobUrl;
link.download = fileName;
document.body.appendChild(link);
link.click();
}