Component({ data: { newMessage: [] }, lifetimes: { ready: function() { const db = wx.cloud.database() db.collection("likeData").where({ type: "publisher" }).get({ success: function (res) { this.processData(res.data) }.bind(this) }) } }, methods: { processData: function (arr) { const db = wx.cloud.database() for (let i = 0; i < arr.length; i++) { db.collection("publisherInfoData").doc(arr[i].id).get({ success: function (res) { arr[i].publisherAvatar = res.data.publisherAvatar arr[i].publisherName = res.data.publisherName this.setData({ newMessage: arr }) }.bind(this) }) } } } })