微信小程序利用云函数获取带参二维码遇到问题
let url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + event.at request({ url, method: 'POST' , responseType: 'arraybuffer' , json: { page: "pages/index/index" , scene: "1234-231" } }, (err, res, body) => { resolve(res) } ) }) |
wx.cloud.callFunction({//小程序端 name: 'createqrcode' , data: { at:res.result.atdata }, success: res345 => { console.log(res345.result) var base64 =wx.arrayBufferToBase64(res345.result) console.log( "base64:" +base64) } }) |
返回值body是很多人文章提到的“乱码”,但加了responseType:
'arraybuffer’
后获取的值扔到wx.arrayBufferToBase64()里仍然返回NULL,求解。或者各位有什么方法把这个返回值转成图片?