首页 > 其他 > 详细

axiox下载文件

时间:2020-01-07 13:47:53      阅读:109      评论:0      收藏:0      [点我收藏+]
 axios.request({ url: url, method: method, responseType: ‘blob‘ })
                .then(response => {
                    let data = response.data;
                    let blob = new Blob([data], { type: "" }),
                        objectURL = URL.createObjectURL(blob),
                        $a = document.createElement("a");
                    blob.lastModifiedDate = new Date();

                    $a.setAttribute("href", objectURL);
                    $a.setAttribute("download", this.table.currentRow.name);
                    $a.click();
                    $a = null;
                })

 

axiox下载文件

原文:https://www.cnblogs.com/shenjichenai/p/12160835.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!