报错 is not defined,如何解决?
发布于 7 年前 作者 xiuying99 13587 次浏览 来自 官方Issues

console.log(serviceList)

打印serviceList时报错

data: {
  serviceList: []
},

getNearServices: function () {
    let that = this;
    const { latitude, longitude } = this.data;
    console.log(this.data)
    wx.cloud.callFunction({
      name: 'getService',
      data: {
        latitude,
        longitude
      },
      success: function (res) {
        console.log('getNearServices-->',res);
        that.setData({
          serviceList: res.result.list
        })
        console.log(serviceList)
      },
      fail: console.error
    })
  },

1 回复

console.log(that.serviceList)

回到顶部