this.$http.post(`url`, {
responseType: "blob" //数据返回类型
}).then((res => {
let url = window.URL.createObjectURL(new Blob([res]));
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", `operlog_${new Date().getTime()}.xlsx`); //指定下载后的文件名,防跳转
document.body.appendChild(link);
link.click();
}))
vue a下载
于 2022-03-30 15:26:09 首次发布