js实现下载文件
downloadFile(url, fileName) {
fetch(url, {
headers: this.headers,
})
.then((response) => response.blob())
.then((blob) => {
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.click();
});
},
downFile() {
this.downloadFile(
this.baseUrl + "/templateFile/名称.docx",
"名称.docx"
);
},