1、获取access_token
GET
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=你的小程序appid&secret=你的小程序secret
2、获取二维码
POST
https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token= 获取到的access_token
body参数:
scene: ‘a=1’,//跳转带参
path : ‘pages/user/user’//跳转页面
返回图片Buffer数据
3、获取 scene 值
Page({
onLoad (query) {
// scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
const scene = decodeURIComponent(query.scene)
}
})