控制台输出this.data.abc没有数据,点击三角号才显示,也无法渲染到wxml页面上。
for_await_box: async function (i, _, data_all, users_collection_id_list) {
await db.collection("daiyue_news_" + i).where({
_id: _.in(users_collection_id_list)
}).get({
success: async (res) => {
console.log("res.data:", res.data)
//解构数组
data_all.push(...res.data)
}
})
},
get_users_collection_data: async function (users_collection_id_list) {
return new Promise((resolve, reject) => {
const _ = db.command
const data_all = []
for (let i = 0; i < 3; i++) {
this.for_await_box(i, _, data_all, users_collection_id_list)
resolve(data_all)
}
})
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
var users_information_all = await app.get_db_users_information()
// console.log("users_information_all:", users_information_all)
var users_collection_id_list = users_information_all.data[0].collection_add_news_id
// console.log("users_collection_id_list:", users_collection_id_list)
var data_all = await this.get_users_collection_data(users_collection_id_list)
console.log("data_all:",data_all)
this.setData({
data_all: data_all,
users_information_all:users_information_all
})
console.log("this.data.data_all:", this.data.data_all)
console.log("this.data.users_information_all:", this.data.users_information_all)
},
``````
```