1檀夹、在請求接口的時候請求頭要添加responseType: 'blob'
2雁社、拿到返回的文件流進行下載
const link = document.createElement("a"); //創(chuàng)建a標簽
let blob = new Blob([response], { type: "application/vnd.ms-excel" }); // response就是
接口返回的文件流
let objectUrl = URL.createObjectURL(blob);
link.href = objectUrl;
link.download = "網(wǎng)點數(shù)據(jù)"; // 自定義文件名
link.click(); // 下載文件
URL.revokeObjectURL(objectUrl); // 釋放內(nèi)存