uniapp转换方法(需要使用uni的api,不可以使用js的api)
// #ifdef APP-PLUS
//这里的data就是后台返回的arraybuff格式数据
fileName = header['Content-Disposition'].match(reg)[3] //这个是获取请求头的文件名字
const arrayBuffer = new Uint8Array(data)
verifyImg = "data:image/png;base64,"+uni.arrayBufferToBase64(data)
console.log(verifyImg);
// #endif
js转换方法
// #ifdef H5
//这里的data就是后台返回的arraybuff格式数据
fileName = header['content-disposition'].match(reg)[3]//这个是获取请求头的文件名字
verifyImg = 'data:image/png;base64,' + btoa(new Uint8Array(data).reduce((data,byte)=>data + String.fromCharCode(byte), ''))
// #endif