let config = {
headers: {
"Content-Type": "multipart/form-data",
token: token,
},
responseType: "blob",
};
axios
.get(this.apis.templateList.exportBook, config)
.then((res) => {
console.log(res.data);
loading.close();
const blob = new Blob([res.data], {
type: "application/vnd.ms-excel;charset=utf-8",
});
const downloadElement = document.createElement("a");
const href = window.URL.createObjectURL(blob);
downloadElement.href = href;
downloadElement.download = "数据统计.xlsx";
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement); // 下载完成移除元素
window.URL.revokeObjectURL(href); // 释放掉blob对象
})
.catch((err) => {});