小程序云开发collection().get()无法获取数据库数据?

发布于 8 年前作者 qiangtang8654 次浏览最后编辑 8 年前来自 issues

不是权限问题。

onLoad: function (options) {
    const db = wx.cloud.database()
    const ce = db.collection('tst2').get({
      success: function (res) {
        console.log(res.data)
      }
    })
    this.setData({
      "imgUrls": ce
      })
  }

已经解决

const db = wx.cloud.database()
    db.collection('prj').limit(4).get({
      success: res => {
        this.setData({
          "prjUrls": res.data
        })
      }
    })
1 回复
songjuan
songjuan1 楼6 年前

setData写在success里