当前位置:首页 > 微信 > 正文

微信小程序带参数生成二维码

11-26 微信

标签:秘钥   微信   grant   mit   header   jin   eth   idt   base64   

wx.request({
            url: ‘https://api.weixin.qq.com/cgi-bin/token‘,
            header: { ‘content-type‘: ‘application/json‘ },
            data: {
                grant_type: ‘client_credential‘,
                appid:‘appid
                secret: ‘秘钥‘
            },
            success(res) {
                accessToken = res.data.access_token
                wx.request({
                    //url: ‘https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=‘ accessToken,
                    url: ‘https://api.weixin.qq.com/wxa/getwxacode?access_token=‘ accessToken,
                    method: ‘POST‘,
                    responseType: ‘arraybuffer‘,
                    data: {
                        "path": ‘扫码跳转的路径‘,
                        "width": 430,   
                    },
                    success(res) {
                        console.log(res.data)
                        let base64 = wx.arrayBufferToBase64(res.data)
                        console.log(base64)
                        let codeImg= ‘data:image/PNG;base64,‘   base64

                        console.log(codeImg)
                        _this.sdd = codeImg
                    },
                })
            }
        })

来个大佬链接:

https://juejin.im/post/5b9b8772e51d450e9162a271

微信小程序带参数生成二维码

标签:秘钥   微信   grant   mit   header   jin   eth   idt   base64   

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/weixin/15924.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 2266822访问次数
  • 建站天数
  • 头条文章

    图文推荐

    站长推荐

    友情链接