赞
踩
##1
import download from 'downloadjs'
//这个res是后台返回的文件流
download((new Blob([res])), 'contract.pdf', 'application/pdf')
let pdfContent = res; const blob = new Blob([pdfContent], { type: "application/pdf"}); const url = window.URL.createObjectURL(blob); // 创建a标签并设置下载属性 const a = document.createElement("a"); a.style.display = "none"; a.href = url; a.download = "downloaded_file.pdf"; // 将a标签添加到页面中并触发点击事件 document.body.appendChild(a); a.click(); // 释放URL对象 window.URL.revokeObjectURL(url);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。