导出使用 location.href = ’ url '; 此方法不仅可以导出Excel …
//导出Excel
exportExcel() {
this.$axios.get("接口地址",{
params:{
参数1: data ...
}}).then(res => {
if(res.request.status === 200) {
// 导出
location.href = res.request.responseURL;
// window.open(res.request.responseURL);
this.$message({
message: '导出成功', type: 'success'});
}
}).catch( err => {
this.$message.error('导出失败');
})
},