核心就是在调用.all的时候,map全部函数,就算失败了也给一个返回值,确保函数全部执行
Promise.all([fn,fn1...].map(p=>{
//.then返回需要的东西 .catch返回一些错误信息
return p.then(e=> {
return p
}).catch(err=> return '错误了')
})).then( res => {
//拿到需要的数据
}).catch(reason => {
console.log(reason)
})