首页 > vue-route beforeEach 不能跳转transition.redirect({path:'/login'});

vue-route beforeEach 不能跳转transition.redirect({path:'/login'});

route.beforeEach(function(transition){
auth_pass(transition).then((data)=>{
    if('not_bind_account' == data){
        console.log("auth ok fail");//这里有打印!
        transition.redirect({path:'/login'});//这里不会跳转,执行到这里来的
        console.log('after !!!');
    }else{
        transition.next();
    }
}).catch((fail)=>{
    console.log("auth ok fail");
    console.log(transition.redirect({path:'/login'}));//这里不会跳转,
});
});
请教一下,是不是beforeEach不支持promise里的transition.redirect(xxx)?
auth_pass我是封装的一个promise实现向服务器请求验证.

没有报错吗?

【热门文章】
【热门文章】