//获取文件流 await downLoadFile(this.queryFrom.casePdfUrl).then((res) => { this.downloadPDF(res, this.queryFrom.casePdfName); }); }, /** * 下载PDF */ downloadPDF(res, fileName) { if (res.headers["content-disposition"]) { var fileName = res.headers["content-disposition"].match(/filename(\S*)xls/)[0]; } //下载别的类型修改这里 let blob = new Blob([res.data], { type: "application/pdf", }); var link = document.createElement("a"); link.href = window.URL.createObjectURL(blob); link.download = decodeURIComponent(fileName).replace("filename=", "");; link.click(); URL.revokeObjectURL(link.href); // 下载完成释放URL 对象 document.body.removeChild(link); // 移除a标签 },
12-13
242
01-07
329
06-03