api.js封装请求

1. 传入对象格式如 

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

 

posted on 2019-02-11 19:27  natsu07  阅读(446)  评论(0编辑  收藏  举报