vue + element環境での書き込み方法は、他のフレームワークでも基本的に同じです。
これは主に、処理後にバックグラウンドから返されたデータを.xlsxファイルとしてダウンロードし、クリックしてダウンロードすることをシミュレートすることです。
axios({
method: "get",
url: "url****",
responseType: "blob", // 重点
headers: {***},
params: params,
})
.then((res) => {
let url = window.URL.createObjectURL(new Blob([res.data]));
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", this.$route.meta.title + ".xlsx");
document.body.appendChild(link);
link.click();
})
.catch(() => {
this.$message.error("网络错误!");
});