二进制文件下载兼容写法
let blob = new Blob([response]);
if ("download" in document.createElement("a"))
{
// let objUrl = window.URL.createObjectURL(blob);
// window.location.href(objUrl);
// 支持a标签download的浏览器
const a = document.createElement("a");
a.download = filename;
a.style.display = "none";
a.href = window.URL.createObjectURL(blob);
document.body.appendChild(a);
a.click();
URL.revokeObjectURL(a.href);
document.body.removeChild(a);
}
else
{ // 其他浏览器
navigator.msSaveBlob(blob, filename);
}