data:{
qrimg: " ",
showCodeImg:true,
}
wx.request({
url: app.globalData.siteurlh5 +’/api/accesstoken.php’, //请求accesstoken
method: ‘GET’,
success: function (res) {
console.log(res.data.access_token, ‘000’)
const data = JSON.stringify({
path: “pages/index/index”
});
wx.request({
url: ‘https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=’+res.data.access_token, // 正方形二维码
//url: ‘https://api.weixin.qq.com/wxa/getwxacode?access_token=’+res.data.access_token, // 小程序码
data: data,
method: “POST”,
responseType: ‘arraybuffer’,
success(res) {
// console.log(“data:image/PNG;base64,” + wx.arrayBufferToBase64(res.data),‘url’) 把数据转为base64,才能展示在页面上
that.setData({
qrimg:“data:ima