用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
})
}
})