html52.com
我爱小程序-开发者交流社区

关于在app.js中跳转的我觉得的bug

问题模块 框架类型 操作系统 工具版本
开发者工具 小程序 macOS 1.02.1801081

在app.js中onLaunch跳转页面,有的时候跳转成功,有的时候跳转失败,我觉得可能是app.json和app.js加载顺序的问题


wx.getUserInfo({
          success: res => {
            console.log(res)
            // 可以将 res 发送给后台解码出 unionId
            this.globalData.userInfo = res.userInfo
 
            // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
            // 所以此处加入 callback 以防止这种情况
            console.log(this.userInfoReadyCallback)

            if (this.userInfoReadyCallback) {


              this.userInfoReadyCallback(res)


            } else if (res.userInfo) {
              wx.navigateTo({
                url: '../index/index',
                success:function(){
 
                },
                fail:function(){
                  that.onLaunch()
                }
              })
               
            }       
          },
          
          }
        })

我这里写的是如果跳转失败了就重新加载onLaunch()  ,我觉得这是一个bug,官方求解

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付