如何在前端展示后端返回的pdf Base64格式字符串

// fileBase64 就是后端返回的 pdf Base64格式字符串 getPdfDocument(fileBase64) { let fileBlob = this.base64ToBlobsdf(fileBase64,'application/pdf'); let basePdfUrl = window.URL.createObjectURL(fileBlob); sessionStorage.setItem('basePdfUrl', basePdfUrl); location.href = "lookPdf.html"; let newWindow = window.open(""); newWindow.document.write("<iframe width='100%' height='100%' src='"+basePdfUrl+"'></iframe>"); } }) }, base64ToBlobsdf(fileBase64,fileType){ let raw = window.atob(fileBase64); let rawLength = raw.length; let uint8Array = new Uint8Array(rawLength); while (rawLength--){ uint8Array[rawLength] = raw.charCodeAt(rawLength); } return new Blob([uint8Array],{type: fileType}); },
上一篇:【工作实践-11】关于uniapp切换账号登录失败问题


下一篇:中间件之异步通讯组件RabbitMQ入门