Vue 自定义header

时间:2018-06-25 14:40:15   收藏:0   阅读:1271

第一种,全局设置:

Vue.http.headers.common[‘token‘] = ‘YXBpOnBhc3N3b3Jk‘;

第二种,拦截器设置

Vue.http.interceptors.push((request, next) => {
        request.headers.set(‘token‘, token); //setting request.headers
        next((response) => {
            return response
     })
})

 

原文:https://www.cnblogs.com/chenyishi/p/9223749.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!