部分截图、内容等来自
https://www.bilibili.com/video/BV1v7411G7Ht?p=6
以下内容包括我自己练习等

1、同步异步
JS--ES6学习笔记(四)promise
2、promise使用
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
3、promise封装ajax
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
4、fetch
封装好的promise和ajax,直接传入url然后获取resolve,完成异步之间的顺序操作。
JS--ES6学习笔记(四)promise
打印res,我们需要的是其中的json数据,所以底下使用了res.json():
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
5、promise的其他方法 promise.all()、promise.race()

JS--ES6学习笔记(四)promise
1、单独使用promise(比较少)
成功时
JS--ES6学习笔记(四)promise
失败时:
JS--ES6学习笔记(四)promise
2、promise.all()
JS--ES6学习笔记(四)promise
JS--ES6学习笔记(四)promise
使用promise修改异步调用处
JS--ES6学习笔记(四)promise
进度条:
JS--ES6学习笔记(四)promise
promise.all()可以把请求的处理阶段划分开,all就是都请求完后才做的。

promise.race()
JS--ES6学习笔记(四)promise

相关文章: