downloadFiles () {
this.$message.info('文件正在下载,请耐心等待')
const params = {
year: this.queryParam.year ? this.queryParam.year : '',
month: this.queryParam.month ? this.queryParam.month : '',
week: this.queryParam.week ? this.queryParam.week : ''
}
this.axios.get('/spang-safety/sa/download', { params: params, responseType: 'blob' }).then(res => {
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' })
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
document.body.appendChild(a)
a.href = url
a.download = '效果分析'
a.click()
window.URL.revokeObjectURL(url)
})
}
ダウンロード ファイルが表示されます。ダウンロードしたファイルを開くと、内容はダウンロード パスの txt であり、ダウンロードは有効になりません。
おすすめ
転載: blog.csdn.net/weixin_47039061/article/details/131600348
おすすめ
ランキング