【发布时间】:2017-04-16 15:09:47
【问题描述】:
我正在尝试使用一组项目创建一个 Promise.all。因此,如果我这样创建它,它就可以正常工作
Promise.all([
Query.getStuff(items[0]),
Query.getStuff(items[1])
]).then(result => console.log(result))
如果我尝试像这样创建Promise.all,它不起作用
Promise.all([
items.map(item => Query.getStuff(item))
]).then(result => console.log(result))
then 块在 Query.getStuff(item) 之前运行。我错过了什么?
【问题讨论】:
标签: javascript promise