Wx.scanQRCode sweeps the official account, callback is not carried out.

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.

clipboard.png
wx.scanQRCode

clipboard.png
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?

Nov.19,2021

have you solved this problem? I have a similar problem. There is no problem with the Android phone test, but the iPhone phone test can bring up the code scan interface without performing any callback functions.

Menu