查看招标公告 下载招标公告 function downloadPdf(url, fileName) { fetch(url, { method: "get", responseType: "arraybuffer", }).then(res => { if (res.status !== 200) { return res.json() } return res.arrayBuffer() }).then(blobRes => { const e = new Blob([blobRes], { type: "application/octet-stream", "Content-Disposition":"attachment" }); const link = window.URL.createObjectURL(e); let a = document.createElement("a"); a.href = link; a.download = fileName; a.click(); }).catch(err => { console.error(err) }) } |