js:
data:{
listDatas:null//請求的數據存在這個數組里面
}
onLoad: function (options) {
const db = wx.cloud.database();
db.collection('otheritems').get().then(res => {//otheritems是數據庫里面集合的名稱
console.log(res); //如果更新數據成功則輸出成功信息
var that = this;
that.setData({
listDatas: res.data
});
console.log(res.data);
}).catch(err => {
console.log(err); //如果更新數據失敗則輸出失敗信息
})
},