下载文件兼容ie
const data = await requestInterface(); //请求接口
const binaryData = []
binaryData.push(data.data) //放入数据
let blob = new Blob([data.data], {type: data.headers['content-type']})
let fileName = data.headers['content-disposition'].split(';')[1].split('=')[1]
fileName = decodeURI(fileName)
let urlPdf = window.URL.createObjectURL(blob)
if (window.navigator && window.navigator.msSaveOrOpenBlob) { //兼容ie
window.navigator.msSaveOrOpenBlob(new Blob(binaryData, { type: data.type }), fileName)
} else {
const link = document.createElement("a")
link.style.display = "none"
link.href = urlPdf
link.setAttribute("download", fileName)
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href) // 释放URL 对象
document.body.removeChild(link)
}