// 适用于一些有顺序的事情,比如说:
// 我们需要先获取到xx同学的id,然后通过xx同学的id去获得xx同学的班级,
// 然后在通过班级去获取到该班级的老师.
// Promise串联, then函数处理完之后返回的也是Promise。
new Promise((resolve, reject) => {
reject('xxxx'); //跑错,reject
}).then(res => {
console.log(res)
return res;
}, err => {
console.log(err) //走这里,这里没有抛错,正常的逻辑reject
return err
}).then(res => {
console.log(res)
})