getExcel(data){
return axios.get("/writeExcel",data,{responseType: 'blob'});
}
Excel(id){
let data={params:{id:id}}
this.$axios.getExcel(data).then(rs =>{
console.log(rs,'123132')
let blob = new Blob([rs], {type: "application/vnd.ms-excel;charset=utf-8"});
let url = window.URL.createObjectURL(blob);
console.log(blob,'1')
console.log(url,'2')
window.location.href = url;
})
}
查阅了很多资料也设置了blob,仍然无法正确下载excel。求解
这样调用试试