reduce里面使用async await
async create(){
let arr = [xxx]
let topData = await arr.reduce(async (pre, cur) => {
let { data } = await this.$axios({xxx});
return [...(await pre), data];
},[])
}
由于上一个是promise,
需要await 处理上一个(pre),
不然输出都是就是一组Promise,而不是一组数据
网友评论