后台返回二进制流乱码图片

axios.get('/url', {
responseType: 'arraybuffer'
}).then(response => {
return 'data:image/png;base64,' + btoa(
new Uint8Array(response.data).reduce((data, byte) => data + String.fromCharCode(byte), '')
)
}).then(data => {
this.img = data
})

猜你喜欢

转载自blog.csdn.net/lemon_bubbly/article/details/79867034