vue 接受二进制文件流实现导出功能
getTaskDownLoad(data) {
out_qr_csv({ id: data.id }).then((res) => {
// if (res.data.code === 1) {
let blob = new Blob([res.data], {
type: 'application/vnd.ms-excel;charset=UTF-8'
})
let elm = document.createElement('a')
//创建下载的链接
elm.setAttribute('download', '装备数据.xlsx')
let href = window.URL.createObjectURL(blob)
elm.href = href
document.body.appendChild(elm)
elm.click()
//下载完成移除元素
document.body.removeChild(elm)
//释放掉blob对象
window.URL.revokeObjectURL(href)
})
},