1、链接
const elt = document.createElement('a');
elt.setAttribute('href', res);
elt.style.display = 'none';
document.body.appendChild(elt);
elt.click();
window.open(url,"_blank");
2、文件流
const link = document.createElement("a");
let blob = new Blob([res.data], { type: "application/vnd.ms-excel" }); //res.data接口数据
link.style.display = "none";
link.href = URL.createObjectURL(blob);
link.setAttribute("download", decodeURI("订单记录表"));
document.body.appendChild(link);
link.click();
document.body.removeChild(link);