码迷,mamicode.com
首页 > 其他好文 > 详细

vue interceptors 设置请求头

时间:2017-07-07 21:33:45      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:res   过滤器   eth   span   设置   main   color   cti   请求   

在main.js添加过滤器,可以

Vue.http.interceptors.push((request,next)=>{
  //request.credentials = true; // 接口每次请求会跨域携带cookie
//request.method= ‘POST‘; // 请求方式(get,post)
//request.headers.set(‘token‘,‘111‘) // 请求headers携带参数
next(function(response){
return response; }); })

待完善。。。

vue interceptors 设置请求头

标签:res   过滤器   eth   span   设置   main   color   cti   请求   

原文地址:http://www.cnblogs.com/congxueda/p/7133733.html

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