JavaScript/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-Length=0,则 Content-Type 无效化(axios 默认不需要这个字段)
- 请求中如果 data 或者 params 内容为空,即
No categories