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)
},
export function getQRCodeView(id) {
return request({
url: `/XXXXXXXXX/${id}`,
method: 'get',
responseType: 'arraybuffer'//这是重点
})
}
getQRCodeView(channelId).then((res) => {
self.viewQRData = 'data:image/jpeg;base64,' + this.arrayBufferToBase64(res)
})
```