-
安装
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'
},
这俩都指定下就好了