'修改bug'
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @Author: fzq
|
||||
* @Date: 2022-03-04 20:54:54
|
||||
* @LastEditors: fzq
|
||||
* @LastEditTime: 2022-03-06 19:32:34
|
||||
* @LastEditTime: 2022-03-07 09:46:36
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
@@ -195,7 +195,22 @@ export default {
|
||||
this.listQuery.code = key
|
||||
// console.log(this.listQuery)
|
||||
download(this.listQuery).then(res => {
|
||||
console.log(res)
|
||||
let fileName = ''
|
||||
const contentDisposition = res.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
|
||||
}
|
||||
const blob = new Blob([res.data])
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(blob)
|
||||
reader.onload = (e) => {
|
||||
const a = document.createElement('a')
|
||||
a.download = fileName
|
||||
a.href = e.target.result
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
}
|
||||
// const fileName = `${+new Date()}.xlsx`
|
||||
// const blob = new Blob([res], { type: 'application/vnd.ms-excel;charset=utf-8' })
|
||||
// if (navigator.msSaveBlob) {
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user