use wx.scanQRCode to scan the official account. Ok, is displayed on the tool, but no callback is performed when using Wechat to scan, so you jump to
directly.
wx.scanQRCode
configuration of wx.config is also successful
weixinSdk() {
var wxs = this.wxMation
console.log(wxs)
wx.config({
debug: true,
appId: wxs.appId,
timestamp: wxs.timestamp,
nonceStr: wxs.nonceStr,
signature: wxs.signature,
jsApiList: ["checkJsApi", "scanQRCode"]
});
wx.error(function (res) {
alert(":" + res.errMsg);//wx.config
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: ["scanQRCode"],
success: function (res) {
}
});
wx.scanQRCode({
needResult: 1, // 01
scanType: ["qrCode","barCode"], //
success: function (res) {
alert(JSON.stringify(res))
var result = res.resultStr; // needResult 1
alert(":" + result);
// window.location.href = result;//
},
error:function(res){
alert(res)
}
});
})
}
is there any god who can explain the code above?