优化导出文件的名称
parent
2b45cc0b3c
commit
a6ed5d645b
|
@ -224,7 +224,7 @@ export const downloadFile = function ({ url, params, method, filename }) {
|
||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
// headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
|
// headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
const fileName = window.decodeURI(filename + '.xls' || res.headers['content-disposition'].split('=')[1]) || '文件导出.xls'
|
const fileName = window.decodeURI((filename === undefined ? false : filename + '.xls') || decodeURI(res.headers['content-disposition']).split('=')[1]) || '文件导出.xls'
|
||||||
if (res) {
|
if (res) {
|
||||||
const blob = new Blob([res.data], { type: 'charset=utf-8' })
|
const blob = new Blob([res.data], { type: 'charset=utf-8' })
|
||||||
const elink = document.createElement('a')
|
const elink = document.createElement('a')
|
||||||
|
|
Loading…
Reference in New Issue