//content是base64格式
viewPdf(content) {
console.log("content",content)
const blob = this.base64ToBlob(content)
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob)
} else {
const fileURL = URL.createObjectURL(blob)
window.open(fileURL);//弹出ppf文件
}
},
base64ToBlob(code) {
code = code.replace(/[\n\r]/g, '')
// atob() 方法用于解码使用 base-64 编码的字符串。
const raw = window.atob(code)
const rawLength = raw.length
const uInt8Array = new Uint8Array(rawLength)
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i)
}
return new Blob([uInt8Array], { type: 'application/pdf' })
},