//在前台 調用導出接口的回調中寫入一下代碼
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