优化导出文件的名称

pull/83/head
JackLu2021 2022-12-22 15:53:14 +08:00
parent 2b45cc0b3c
commit a6ed5d645b
1 changed files with 1 additions and 1 deletions

View File

@ -224,7 +224,7 @@ export const downloadFile = function ({ url, params, method, filename }) {
responseType: 'blob'
// headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
}).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) {
const blob = new Blob([res.data], { type: 'charset=utf-8' })
const elink = document.createElement('a')