axios导出 exer
程序员文章站
2022-06-22 12:30:53
this.axios({ url: `${this.domain}ledger/people/exportExcel`, responseType: 'blob', method: 'post', data: params}).then(res => { if(res.data) { let blo ......
this.axios({
url: `${this.domain}ledger/people/exportExcel`,
responseType: 'blob',
method: 'post',
data: params
}).then(res => {
if(res.data) {
let blob = res.data
let a = document.createElement('a')
let url = window.URL.createObjectURL(blob)
let filename = '重点人.xls'
a.href = url
a.download = filename
a.click()
window.URL.revokeObjectURL(url)
}
})