兼容IE下载文件
fetch(url,options).then(res => res.blob().then((blob)=>{
if(window.navigator.msSaveOrOpenBlob){//兼容IE下载
try{
window.navigator.msSaveOrOpenBlob(blob,fileName)
}cath(e){
console.log(e)
}
}else{
const a = document.createElement('a')
const fileUrl = window.URL.createObjectURL(blob)
a.href = fileUrl
a.download = fileName
document.body.appendChild(a)
a.click()
window.URL.revokeObjectURL(url)
document.body.removeChild(a)
}
})).catch((e)=>{})

浙公网安备 33010602011771号