vue前端调后端导出excel
vue
调用downloads方法
downloads(){
axios.get('http://localhost:88/firstManufacturer/downloads', {
responseType:'blob'
})
.then(response=>{
console.log(response)
const url = window.URL.createObjectURL(new Blob([response.data],{type:'application/vnd.ms-excel'}));
const link = document.createElement('a');
link.href = url;
link.download = '导出表.xls';
document.body.appendChild(link);
link.click();
})
},