//在前台 调用导出接口的回调中写入一下代码
const fileName = "设备信息" + new Date().getTime() + ".xls"; // res.data:请求到的二进制数据 const blob = new Blob([response.data], { type: "application/vnd.ms-excel" }); //1.创建一个blob const link = document.createElement("a"); //2.创建一个a链接 link.download = fileName; //3.设置名称 link.style.display = "none"; // 4.默认不显示 link.href = URL.createObjectURL(blob); // 5.设置a链接href document.body.appendChild(link); //6.将a链接dom插入当前html中 link.click(); //7.点击事件 URL.revokeObjectURL(link.href); //8.释放url对象 document.body.removeChild(link); //9.移除a链接dom