第一种,全局设置:
Vue.http.headers.common['token'] = 'YXBpOnBhc3N3b3Jk';
第二种,拦截器设置
Vue.http.interceptors.push((request, next) => { request.headers.set('token', token); //setting request.headers next((response) => { return response }) })
第一种,全局设置:
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