CV改接口
单独写一个axios
axios(`请求地址`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
responseType: 'blob', // 重点
data: { id } // 后端需要的id
}).then(res => {
const data = res.data
const url = window.URL.createObjectURL(
new Blob([data], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
)
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', '任务结果.xlsx')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})