下载blob流文件
//调接口后端返回文件流 fetch(`downloadTemplate`, { method: 'POST', mode: 'cors', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(body), credentials: 'include' }) .then(async (res: any) => { let filename = '模板.xlsx'; const blob = await res.blob(); const url = window.URL || window.webkitURL; const downloadHref = url.createObjectURL(blob); const downloadLink = document.createElement('a'); downloadLink.href = downloadHref; downloadLink.download = decodeURIComponent(filename); downloadLink.click(); }) .catch((e) => { message.error('获取文件信息失败'); });