云开发查询后不能setdata
发布于 5 年前 作者 guiyinglai 5992 次浏览 来自 问答
// 获取商品信息
getgoods :function (){
  var that = this
  db.collection('goods').get().then(res => {
  //  console.log(res.data)
    that.setData({
      goods_list: res.data
    })
 
 
  })
  console.log(that.data.goods_list)
  • 当前 Bug 的表现(可附上截图)

现在打印出来没有that.data.goods_list

  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo
3 回复

题主您好,请问这个问题解决了吗?

var that = this  放到外面试试。。。真是可怕

而且我打印过res.data;这个值是有的

回到顶部