EasyExcel快速实现前端导出(前端)
export1(){
axios.get(`/api/medical-live/logininfor/export`, {
params: {},
contentType: 'application/json',
cache: true,
responseType: "blob"
}).then((res) => {
const link = document.createElement("a");
let blob = new Blob([res.data], { type: "multipary/form-data" });
link.style.display = "none";
link.href = URL.createObjectURL(blob);
link.setAttribute("download", decodeURI(Date.now()+'访问量.xlsx'));
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
console.log(res);
})
},
后台返回

设置 responseType: “blob”

参考:https://blog.csdn.net/whitehats/article/details/111671444