【发布时间】:2017-08-27 18:36:49
【问题描述】:
当我有 401 时,我想重定向用户,但我无法从此上下文访问 router:
Vue.http.interceptors.push(function(request, next) {
// continue to next interceptor
next(function(response) {
if(response.status == 401){
//redirect user here
//tried: Vue.$router and Vue.$route
}
});
});
我该怎么做?
使用:Vue-router 和 Vue-resource
【问题讨论】:
标签: vuejs2 vue-router vue-resource