导出电子表格
axios({ url: "/cardGiveBatchEntity/account/template/download", method: "get", //vue axios(下载文件流)设置返回值类型responseType:‘blob‘ responseType: "blob", }) .then((res) => { console.log(res); //解析文件充blod中解析 const url = window.URL.createObjectURL( new Blob([res.data], { type: "application/vnd.ms-excel" }) ); const link = document.createElement("a"); link.style.display = "none"; link.href = url; link.setAttribute("download", "文件名称.xlsx"); document.body.appendChild(link); link.click(); document.body.removeChild(link); }) .catch((err) => { console.log(err); }); ———————————————— 版权声明:本文为CSDN博主「K哇伊」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/caoluotuo/article/details/120575707
本文来自博客园,作者:zjxgdq,转载请注明原文链接:https://www.cnblogs.com/zjxzhj/p/17078186.html