1、下载
let url = window.URL.createObjectURL(new Blob([res.data])) // 生成一个a标签 let link
= document.createElement('a') link.style.display = 'none' link.href = url //
生成时间戳 let timestamp = new Date().getTime() link.download = timestamp + '.txt'
document.body.appendChild(link) link.click() link.remove()
2、下载流文件
that.percentage=100 const blob = new Blob([res1.data], { type:
'application/zip' }) // new一个二进制对象 const url = window.URL.createObjectURL(blob)
// 转化为url const link = document.createElement('a') // 创建个a标签 link.href = url
link.download = that.projectNameTitle + (new Date()).getTime()// 重命名
link.click() URL.revokeObjectURL(url)
axios返回值要设为流
responseType:‘blob’,

技术
今日推荐
PPT
阅读数 128
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信