码迷,mamicode.com
首页 > 其他好文 > 详细

axiox下载文件

时间:2020-01-07 13:21:25      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:nbsp   element   odi   下载   attr   eth   tee   url   row   

 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下载文件

标签:nbsp   element   odi   下载   attr   eth   tee   url   row   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!