赞
踩
const blob = new Blob([res])
const blobUrl = window.URL.createObjectURL(blob)
arrayBufferToBase64 (buffer) {
var binary = ''
var bytes = new Uint8Array(buffer)
var len = bytes.byteLength
for (var i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i])
}
return window.btoa(binary)
},
//图片
const base64Str = 'data:image/jpeg;base64,' + this.arrayBufferToBase64(res)
//pdf
const base64Str = 'data:application/pdf;base64,' + this.arrayBufferToBase64(res)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。