本篇文章给大家带来的内容是关于如何获取小程序中的二维码(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | wx.request({
url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential',
data: {
appid: '',//自己小程序后台的appid
secret:''//自己小程序的secret
},
success(res) {
console.log(res);
wx.request({
url: 'https://api.weixin.qq.com/wxa/getwxacode?access_token=' + res.data.access_token,
method: 'POST',
responseType:"arraybuffer",
data: {"path": "pages/mys/my","width": 430},
success(res) {
console.log(res)var type = res.header["Content-Type"];
var prefix = "data:" + type + ";base64,";
var imgUrl = prefix+ wx.arrayBufferToBase64(res.data)
console.log(self.imgUrl)self.setData({
imgUrl: imgUrl,
})
})
}
})
|
canvas绘制网络图片的时候,必须要把图片下载到本地。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。