Article From:https://www.cnblogs.com/zhonglinke/p/9970839.html
if (res.status == 200) {
const content = res.data;
const blob = new Blob([content]);
const fileName = “Contract Agreement Template. xls “;
if (“download” in document.createElement(“a”)) {
// Non IE Download
const elink = document.createElement(“a”);
elink.download = fileName;
elink.style.display = “none”;
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href); // Release URL objects
document.body.removeChild(elink);
} else {
// IE10+download
navigator.msSaveBlob(blob, fileName);
}

Leave a Reply

Your email address will not be published. Required fields are marked *