![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
文件下载
Mr.裴
多年前端工作,工业设计 工业协同方向
展开
-
vue 下载文件,文件损坏无法打开
最近通过 axios 接口下载文件的时候,文件不能打开,显示文件损坏是因为在接口请求体中缺少属性 responseType:'blob'export function downloadFileById (id) { return axios({ responseType: 'blob', url: urlHref + id, method: 'get' })}...原创 2021-11-11 16:32:26 · 4886 阅读 · 1 评论 -
VUE 下载文件 二进制转换
最近在做商城类网站,要实现用户资质及商品资质下载功能下面直接上代码 let url = window.URL.createObjectURL( new Blob([data], { type: "application/zip" }) ); let link = document.createElement("a"); link.style.display = "none"; link.href = url; link.setAttribute("download", cod原创 2021-04-07 10:52:25 · 545 阅读 · 0 评论