收藏
回答

用到了bmob,但一直出现这个问题,求大神解答啊啊?

VM78:1 thirdScriptError
Bmob.User is not a constructor;at App lifeCycleMethod onLaunch function
TypeError: Bmob.User is not a constructor
    at pe.onLaunch (http://127.0.0.1:33337/appservice/app.js:10:16)
    at pe. (http://127.0.0.1:33337/appservice/__dev__/WAService.js:2:1646604)
    at new pe (http://127.0.0.1:33337/appservice/__dev__/WAService.js:2:1647269)
    at Function. (http://127.0.0.1:33337/appservice/__dev__/WAService.js:2:1647683)
    at http://127.0.0.1:33337/appservice/__dev__/WAService.js:2:1634843
    at http://127.0.0.1:33337/appservice/app.js:8:1
    at require (http://127.0.0.1:33337/appservice/__dev__/WAService.js:2:1681923)
    at :1:1
    at HTMLScriptElement.scriptLoaded (http://127.0.0.1:33337/appservice/appservice?t=1580722672169:2097:21)
    at HTMLScriptElement.script.onload (http://127.0.0.1:33337/appservice/appservice?t=1580722672169:2109:20)


//app.js 代码
var Bmob = require('/utils/Bmob-2.2.2.min.js');
Bmob.initialize('0bbf738b4c5401ee', '147258');

App({
  onLaunch: function () {
    var user = new Bmob.User() //开始注册用户
    user.auth().then(function (obj) {
      console.log('登陆成功')
    },
      function (err) {
        console.log('失败了', err)
      });
  },
  getUserInfo: function (cb) {
    var that = this
    if (this.globalData.userInfo) {
      typeof cb == 'function' && cb(this.globalData.userInfo)
    } else {
      //调用登录接口
      wx.login({
        success: function () {
          wx.getUserInfo({
            success: function (res) {
              that.globalData.userInfo = res.userInfo
              typeof cb == 'function' && cb(that.globalData.userInfo)
            }
          })
        }
      })
    }
  },
  globalData: {
    userInfo: null
  }
})

最后一次编辑于  2020-02-04
回答关注问题邀请回答
收藏

1 个回答

  • chanchan
    chanchan
    2023-04-06

    解决了么好兄弟

    2023-04-06
    有用
    回复
登录 后发表内容
问题标签