Vue 自定义header

第一种,全局设置:

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

第二种,拦截器设置

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

猜你喜欢

转载自www.cnblogs.com/chenyishi/p/9223749.html