-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[vue] ajax、fetch、axios这三都有什么区别? #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ajax, 实际上就是xmlHttpRequest, 旧瓶装新酒的一种新应用的称呼 |
ajax是概念 异步交换数据的概念 |
ajax是最早出现发送后端请求的技术,属于原生js范畴,核心是使用XMLHttpRequest对象,使用较多并有先后顺序的话,容易产生回调地狱。 fetch号称可以代替ajax的技术,是基于es6中的Promise对象设计的,参数和jQuery中的ajax类似,它并不是对ajax进一步封装,它属于原生js范畴。没有使用XMLHttpRequest对象。 axios不是原生js,使用时需要对其进行安装,客户端和服务器端都可以使用,可以在请求和相应阶段进行拦截,基于promise对象。 |
ajax:封装了原生的XHR,发送请求。 |
个人理解,不一定对: |
[vue] ajax、fetch、axios这三都有什么区别?
The text was updated successfully, but these errors were encountered: