function p () {
return new Promise((resolve) => {
setTimeout(() => {
resolve('我是p')
}, 200)
})
}
p().then(res => {
console.log(res, 'res1')
}).then(res => {
console.log(res, 'res2')
})
console.log('===========分割===========')
p().then(res => {
console.log(res, 'res1')
return '我返回的'
}).then(res => {
console.log(res, 'res2')
})
console.log('===========分割===========')
p().then(res => {
console.log(res, 'res1')
setTimeout(() => {
return 'setTimeout'
}, 100)
}).then(res => {
console.log(res, 'res2')
})
console