- 从数据库获取数据丢失,用云函数就没事?
用josn导入的第一种方法就取不到,只能取到自己添加到,但是云函数就都能取到 //小程序端 selectTs:function(){ var that = this; console.log(this.data.username) const db = wx.cloud.database() const _ = db.command; db.collection('c') .get({ success: function(res) { that.setData({ user:res.data }) } }) // 云函数端 const db = cloud.database() exports.main = async (event, context) => { return await db.collection('c') .get({ success: function(res) { console.log(res.data); } }) } 小程序端 wx.cloud.callFunction({ name:"cc", success: function(res) { console.log(res.result.data); that.setData({ zr:res.result.data }) } })
2021-03-27 - .where()中的值能是变量吗?
db.collection('c') .where({ username:this.data.username })
2021-03-27