axios.get({
method: 'GET',
url: API_URLS.QUERY_BRAND_LIST,
params: params,
success: function (result) {
console.log(JSON.stringify(result))
if (result.code === fetchStatusType.SUCCESS) {
cb(result.data)
} else {
errorCb(result.result || MESSAGES.serverBusy)
}
},
error: function () {
errorCb(MESSAGES.networkError)
}
})
看到vue项目中对axios的封装,对success和error的配置不是很明白,为什么success就是处理成功的回调,error就是处理失败的回调?官网中没有看到success和error的配置选项呢
官网的axios是基于Promise的,不是回调,从你贴出来的代码看,你这个不是官方的,而是别人封装的。