JavaScript/axios:修订间差异
来自康健生活
| 第33行: | 第33行: | ||
<blockquote><pre> | <blockquote><pre> | ||
withCredentials: true</pre></blockquote> | withCredentials: true</pre></blockquote> | ||
== error == | |||
* Content-Type 设置失效 | |||
*: 请求中如果 data 或者 params 内容为空,则 Content-Type 无效化(axios 默认不需要这个字段) | |||
2020年8月26日 (三) 14:34的版本
引言
https://github.com/axios/axios
代码设计
用工厂模式。
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["axios"] = factory();
else
root["axios"] = factory();
})(this, function() {
...
return (function(modules) {
...
})([...])
})
与AJAX
Axios
Promise based HTTP client for the browser and node.js
AJAX
Asynchronous Javascript And XML
参数
withCredentials
withCredentials: true
error
- Content-Type 设置失效
- 请求中如果 data 或者 params 内容为空,则 Content-Type 无效化(axios 默认不需要这个字段)
No categories