美文网首页
2018-05-18 axios的post方式下载excel文

2018-05-18 axios的post方式下载excel文

作者: 安乐_f487 | 来源:发表于2018-09-10 22:34 被阅读0次

1.axios post方式下载excel文件

calculationResultExport(data) {

axios.post('/wechat/myd/calculationResultExport', data, {responseType:'arraybuffer'}).then((res) => {

let blob =new Blob([res.data], {type:"application/vnd.ms-excel"});

let objectUrl =URL.createObjectURL(blob);

let link_a=document.createElement('a');

let file_name='test.xls';

link_a.href=objectUrl;

link_a.download=file_name;

link_a.click();

}).catch(function (res) {

});

}

相关参考:http://www.cnblogs.com/wanliyuan/p/5650105.html

2.git 工具sourceTree免登录https://blog.csdn.net/u011498933/article/details/78329448

相关文章

网友评论

      本文标题:2018-05-18 axios的post方式下载excel文

      本文链接:https://www.haomeiwen.com/subject/ycegdftx.html