router.get ("/ list",async (ctx) = > {
)ctx.state = {
title:""
};
await menusModel.order("id").select().then((result)=>{
async.map(result,(item,callback)=>{
menusModel.find({id:item.pid},"title").then((res)=>{
if(item.pid != 0){
item.parent=res.title;
}else{
item.parent="";
}
callback(null, item);
})
},(err,rows)=>{
ctx.render("admin/menu/list.html",{list:rows});
});
})
})
callback is also called, and the rows in the callback function can also be printed, and the execution stops after one line of ctx.render, and the page cannot be rendered