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

为什么我的这部分代码在onload里面,不会被运行,会直接被跳过?

代码像下面一样,目的是为了检测数据库有没有这个用户,如果有就跳过这个环节

 const db = wx.cloud.database()
    db.collection('student').where({
      _openid: app.globalData.openid
      })
      .get({
        success: function(res) {
          console.log(res.date.lenght)
          if (parseFloat(res.date.lenght) > 0) {
            wx.navigateTo({
              url: '../index1/index1',
            })
          }
        },
      })

网友回复

肖达炫:

同问,楼主有没解决

金柯:
把console.log(res.date.lenght)改为console.log(res.data.length)

评论 抢沙发

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

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

云免签H5支付