一个点击事件中报错?
发布于 5 年前 作者 zlai 12825 次浏览 来自 问答

调用 wx.cloud.callFunction报 Cannot read property ‘callFunction’ of undefined

TypeError: Cannot read property ‘callFunction’ of undefined

其他地方使用wx.cloud.callFunction一切正常

2 回复
<view class="weui-dialog__ft">
        <button class="button-submit" style="width:250px" bindtap="submitResult">提交</button> 
      </view>

 submitResult() {
    let name = this.data.name
    let phone = this.data.phone
    let wx = this.data.wx

    if(name =='' && phone == '' && wx == ''){
    
      wx.showToast({
        title: '请输入相应的信息',
      })
      return
    }
    var data = {
      name: name,
      phone: phone,
      wx: wx,
      correctRate: this.data.correctRate,
      minutes: this.data.minutes,
      result: this.data.result,
      data: getApp().globalData.resultExams
    }
    console.log(data)

    wx.cloud.callFunction({
      name: 'examResult',
      data: {
        type: 'add',
        data: data
      },
      success: res=>{
        console.log(res)

      }
    })

    this.close()
    
  },

回到顶部