Vue路由拦截

router.beforeEach((to, from, next) => {
    //拦截指定路由
    if(to.path === '/home'){
        //todo
    }else{
        scrollTo(0, 0);
        next();
    }
})

 

posted @ 2019-10-27 12:09  绿谷  阅读(1995)  评论(0编辑  收藏  举报