文件名称:Promise扫盲贴
文件大小:42KB
文件格式:PDF
更新时间:2024-01-02 17:21:49
IS mis om
then then函数可以return另一个promise: const p1 = new Promise((resolve, reject) =>{ resolve('p1') }) const p2 = new Promise((resolve, reject) =>{ setTimeout(() =>{ resolve('p2') },3000) }) p1.then(res => { console.log(res) return p2 }).then(res =>{ // p2 resolve后才执行 console.log(res) }) //p1