【微信】微信小程序ISO上wx.scanCode BUG

==================================================

BUG情况:

  小程序在onLoad 主动调用wx.scanCode,安卓手机没有问题。iso调用失败。不能自动打开扫码。

解决方法:

  在wx.scanCode外,加上延迟加载:

setTimeout(()=>{
      wx.scanCode({
        success: (res) => {
          
        },
        fail: (res) => {
          
          wx.showToast({
            title: '扫码失败',
            icon: 'none',
            image: '../../imgs/error.png',
            duration: 2000
          });
        },
        complete: (res) => {

         
        }
      })
    },500)