TypeError: Cannot read property **** of undefined?

小程序 文章 2022-03-29 09:40 452 0 全屏看文

AI助手支持GPT4.0

TypeError: Cannot read property **** of undefined?TypeError: Cannot read property **** of undefined?

TypeError: Cannot read property **** of undefined?
 getList() {    wx.cloud.callFunction({      name: "getwz",      complete: res => {        for (let i = 0; i < res.result.data.length; i++) {          res.result.data[i].wzzt = res.result.data[i].sj[this.data.sjxxindex][0]          this.setData({            rmb: res.result.data          })        }      }    })错误信息: TypeError: Cannot read property 'undefined' of undefined

 getList() {    wx.cloud.callFunction({      name: "getwz",      complete: res => {        for (let i = 0; i < res.result.data.length; i++) {          res.result.data[i].wzzt = res.result.data[i].sj[this.data.sjxxindex][0]          this.setData({            rmb: res.result.data          })        }      }    })错误信息: TypeError: Cannot read property 'undefined' of undefined

回答:

brave:

打印一下 res

小乙:

res.result.data[i].sj[this.data.sjxxindex] 大概率是这的问题,打印下吧


信息技术董超:

我是小白,刚学小程序制作卡这里了,大神求教!

-EOF-

AI助手支持GPT4.0