// res为后端传递的数据
const blob = new Blob([res], {
type: "application/ms-excel",
});
const elink = document.createElement("a");
elink.download = "文件名.xls";
elink.style.display = "none";
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href); // 释放URL对象
document.body.removeChild(elink);
发送请求时需要设置responseType: 'blob', 不然打开的excel会有乱码
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。