api.js封装请求

时间:2023-03-10 00:29:55
api.js封装请求

1. 传入对象格式如

{
a:{
getData:{
url: 'xx/xx/xx',
method: 'get',
require:['id', 'name'], // 简单检查 必传参数确实则不发请求
changeParamsProp:{ // 防止后端更改参数名
id: 'userId'
},
changeDataProp:{
},
cacheKey:'xxx' // 检查localStorage如果有这个key就不发请求
}
},
b:{
}
}