拉取微信授权的时候,第一次授权拉不到,在IOS机型上第一次拉不到,安卓机型可以,为什么?
created () {
// 微信浏览器开启
this.generateJsApiSign()
},
methods: {
generateJsApiSign (callback) {
if (this.$isWechat) {
home.generateJsApiSign((data) => {
if (data) {
wx.config({
debug: false,
appId: this.$appid,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: ['scanQRCode', 'chooseWXPay'],
success: () => {
this.isconfig = true
}
})
wx.ready(() => {
if (callback) callback()
console.log('wx ready')
})
wx.error(function (res) {
if (res.errMsg == 'config:ok') this.isconfig = true
})
}
})
}
},