前端导出(post请求方式)
当后端接口不是一个地址调用接口直接导出的,而是post方式,参数类型是body怎么办嘞1.我们在接口成功的回调里加入const url = window.URL.createObjectURL(new Blob([后端返回的数据]))const a = document.createElement('a');a.href=url;a.setAttribute('download','导出的文件名'
·
当后端接口不是一个地址调用接口直接导出的,而是post方式,参数类型是body怎么办嘞
1.我们在接口成功的回调里加入
const url = window.URL.createObjectURL(new Blob([后端返回的数据]))
const a = document.createElement('a');
a.href=url;
a.setAttribute('download','导出的文件名');
a.click();
a.remove();
更多推荐
所有评论(0)