码迷,mamicode.com
首页 > Windows程序 > 详细

api.js封装请求

时间:2019-02-11 20:15:32      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:bsp   class   col   code   param   nbsp   参数   pre   url   

1. 传入对象格式如 

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

 

api.js封装请求

标签:bsp   class   col   code   param   nbsp   参数   pre   url   

原文地址:https://www.cnblogs.com/natsu07/p/10362940.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!