后端导出Excel,前端接收
exportSubscribe().then((res) => {
let fileName = "订阅关系列表.xls";
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel",
});
let reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function (e) {
let a = document.createElement("a");
a.download = fileName;
a.href = URL.createObjectURL(blob);
$("body").append(a);
a.click();
$("body").remove(a);
};
});