Small micro-channel cloud development program database request data

js:

data:{

listDatas: null // presence of the requested data array inside the

}

onLoad: function (options) {
  const db = wx.cloud.database();
  db.collection ( 'otheritems'). get (). then (res => {// otheritems is set inside the name of the database
    console.log (res); // update the data successfully if the outcome is successful information
    var that = this;
    that.setData({
      listDatas: res.data
    });
    console.log(res.data);
  }).catch(err => {
    console.log (err); // if the update fails the data output failure information
  })
},

Guess you like

Origin www.cnblogs.com/lsyy2017/p/11568389.html