diff --git a/src/utils/request-download.js b/src/utils/request-download.js index 03ab1808..c5e14a7f 100644 --- a/src/utils/request-download.js +++ b/src/utils/request-download.js @@ -50,7 +50,8 @@ service.interceptors.response.use( const a = document.createElement('a') // xls类型: application/vnd.ms-excel // xlsx类型:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8 - const href = URL.createObjectURL(new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' })) + // const href = URL.createObjectURL(new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' })) + const href = URL.createObjectURL(new Blob([res], { type: response.headers['content-type'] })) a.download = fileName a.href = href a.click()