第一种,全局设置:

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

第二种,拦截器设置

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

 

posted on 2018-06-25 12:00  chester·chen  阅读(1458)  评论(0编辑  收藏  举报