标签:for 导出 headers 返回 style bsp pen code url
axios({
method: ‘get‘,
url: url,
params: payload,
responseType: ‘blob‘, // 必须加上
headers: {
‘Content-Type‘: ‘multipart/x-www-form-urlencoded‘
}
})
axios(url).then((res)=>{
let blob = new Blob([res.data])
let downloadElement = document.createElement(‘a‘)
let href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = ‘数据导出.xls‘
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
})
标签:for 导出 headers 返回 style bsp pen code url
原文地址:https://www.cnblogs.com/hpx2020/p/13344303.html