order_list.forEach(async (elm,index)=>{
(order_list[index] as any).order_goods = await this.og.find({
where:{
order_id:elm.order_id
}
});
});
如代码是不能正确赋值的
正确的写法应该是什么?(注:使用forEach,find操作是Promise)
order_list.forEach(async (elm,index)=>{
(order_list[index] as any).order_goods = await this.og.find({
where:{
order_id:elm.order_id
}
});
});
如代码是不能正确赋值的
正确的写法应该是什么?(注:使用forEach,find操作是Promise)
10 回答11.7k 阅读
2 回答3.2k 阅读✓ 已解决
4 回答2.2k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
3 回答1.2k 阅读✓ 已解决
3 回答868 阅读✓ 已解决
5 回答2.3k 阅读
forEach 的 callback 不能指定为 async 函数。