axios.post(url, params, {
responseType: "arraybuffer",
})
.then((response) => {
if (response.data.code === 200) {
const csvData = res;
// 创建一个 Blob 对象
const blob = new Blob([csvData], { type: 'text/xlsx' });
// 创建一个下载链接
const downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = 'xx.xlsx';
// 触发点击事件来下载文件
downloadLink.click();
// 释放 URL 对象
URL.revokeObjectURL(downloadLink.href);
}
})
.catch((error) => {
reject(error);
});
11-10
1015
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-09
792
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-01
309
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-24
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交