-
安裝
npm install js-file-download --save
-
- 使用
-
-
import fileDownload from 'js-file-download'
let _that=this_that.$axios.get(_that.$api.etmservice+"/export/excel/datamonitor",
{responseType: 'blob',headers: {'Content-Type': 'application/octet-stream'}}).then(function(res){fileDownload(res.data,'safa.xlsx')})
-
-
- 使用
會出現打開文件損壞問題
解決
responseType: 'blob',
headers:{
'Content-Type': 'application/json; application/octet-stream'
},
這倆都指定下就好了