1.后台返回的Blob文件流格式在ie和谷歌是不一样的:
谷歌的可能是
{
size:74,
type:"application/json"
},
而IE的是
{
size:74,
type:"application/json;charset=UTF-8"
}
2.下载文件需要判定是否是IE
//下载文件
export function downloadPDF(data, name = 'file.docx') {
if (!data) {
return
}
var blob = new Blob([data], {
type:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
})
if (isIE()) {
window.navigator.msSaveOrOpenBlob(blob, name)
return
}
var url = window.URL.createObjectURL(blob)
var aLink = document.createElement('a')
aLink.style.display = 'none'
aLink.href = url
aLink.setAttribute('download', name)
document.body.appendChild(aLink)
aLink.click()
document.body.remov