this.$http //调用axios
.get(this.api.exportData , {
params:{
feedingBaseBeginTime: this.xldate[0],
feedingBaseEndTime: this.xldate[1],
sysRecordBeginTime: this.zddate[0],
sysRecordEndTime: this.zddate[0],
},
responseType: "blob",
})
.then((result) => {
const linkElement = document.createElement("a");
var blob = new Blob([result.data], {
type: "application/vnd.ms-excel",
});
var url = window.URL.createObjectURL(blob);
linkElement.setAttribute("href", url);
linkElement.setAttribute("download", "文件名.xlsx");
linkElement.click();
});
},
纯后端导出excel
于 2022-04-01 09:35:55 首次发布