如下图所示,如何获取5个Promise中的值赋值给新的数组?

发布于 8 年前作者 fang688139 次浏览最后编辑 8 年前来自 issues

如何获取5个Promise中的data值赋值给新的数组,网上没搜到类似的,,,,谢谢,

2 回复
xcai
xcai1 楼6 年前
Promise.all(5Promise数组).then(res=>{
	// res 就是结果数组
	console.log(res)
}).catch(res=>{
	// res 第一个reject的结果
	console.log(res)
})
yangguiying
yangguiying2 楼6 年前

Promise.all了解一下。