小程序合并promise请求

将每个需要合并的请求push到数组
let p= []
let p1 = new Promise((resolve, reject) => {
    resolve();
    reject();
});
p.push(p1)
let p2 = new Promise((resolve, reject) => {
    resolve();
    reject();
});
p.push(p2)
promise.all(p).then(res=>{
    console.log(res)
})

你可能感兴趣的:(小程序合并promise请求)