版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hefeng6500/article/details/82988624
首先看下我们接收到的请求:
特别注意:responseType: 'blob'
axios({
method: 'GET',
url: '/api',
params: params,
responseType: 'blob'
}).then(res=>{
let blob = new Blob([res.data], {type: "application/vnd.ms-excel"});
let url = window.URL.createObjectURL(blob);
window.location.href = url;
}).catch(err=>{
console.log(err)
})
参考:vue axios 请求二进制流excel文件,response乱码