Closed TheNorthMemory closed 3 years ago
project specifical configuration merging with the following method:
/**
* Deep merge the input with the defaults
*
* @param {object} config - The configuration.
*
* @returns {object} - With the built-in configuration.
*/
static withDefaults(config = {}) {
const defaults = {...this.defaults}
config.headers = {...defaults.headers, ...config.headers}
config.params = {...defaults.params, ...config.params}
config = {...defaults, ...config}
return config
}
refer to axios/axios#2844, 0.20.0
url
,method
,data
三个参数始终来自实例参数,mergeConfig
方法无法合并(会丢失),Decorator.constructor
不能依赖此方法。