Component({ data: { newMessage: [] }, lifetimes: { ready: function() { this.init() } }, pageLifetimes: { show: function () { this.init() } }, methods: { init: function () { wx.showNavigationBarLoading() const db = wx.cloud.database() const _ = db.command db.collection("likeData").where({ type: "publisher" }).get({ success: function (res) { if (res.data.length == 0) { wx.hideNavigationBarLoading() return } var con = _.eq(res.data[0].id) for (let j = 1; j < res.data.length; j++) { con = con.or(_.eq(res.data[j].id)) } db.collection("mainData").orderBy("time", "desc").limit(20).where({ publisherId: con }).get({ success: function (res) { this.setData({ newMessage: res.data }) wx.hideNavigationBarLoading() }.bind(this) }) }.bind(this) }) } } })