微信小程序 云开发 数据库 请求数据

时间:2019-09-22 18:44:24   收藏:0   阅读:339

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); //如果更新数据失败则输出失败信息
  })
},

原文:https://www.cnblogs.com/lsyy2017/p/11568389.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!