``` onLoad: function(options) {
var that = this;
var access_token = that.data.access_token
var scene = decodeURIComponent(options.scene)
wx.request({
url: 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' + this.data.access_token,
data: {
scene: '000',
page: "../../pages/home/home",
width: 200
},
method: "POST",
responseType: 'arraybuffer',
success: res => {
var base64 = wx.arrayBufferToBase64(res.data);
this.setData({
urlIMG: 'data:image/PNG;base64,' + base64
})
console.log(that.data)
},
fail(e) {
}
})
},
从你的base64编码看,明显偏短,显然不足以显示一个二维码
你在请求了获取小程序码接口并得到结果后,没有判断是否正确返回,直接将结果转为 base64。按照你的代码,你得到的结果应该是 '{"errcode":41030,"errmsg":"invalid page hint: [xAzcMa07611531]"}',因为你的 page 参数填错了。微信官方文档对 page 参数是这样说明的 -- “必须是已经发布的小程序存在的页面(否则报错),例如 pages/index/index, 根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面”
怎么解决的