js二进制流生成文件下载
this.$api.ExportAPI({responseType: 'blob'}).then(data => {
// 这里的data是接口ExportAPI返回的二进制数据流
let eleLink = document.createElement('a')
// type值为txt或csv,导出为.txt格式和.csv格式(Excel打开的格式)
eleLink.download = '导出文件名' + `.${type.toLowerCase()}`
eleLink.style.display = 'none'
let blob = new Blob([data])
eleLink.href = URL.createObjectURL(blob)
document.body.appendChild(eleLink)
eleLink.click()
URL.revokeObjectURL(eleLink.href)
document.body.removeChild(eleLink)
})