2017-11-05 6 views
0
router.beforeEach((to, from, next) => { 
const authUser = JSON.parse(window.localStorage.getItem("authUser")); 
if (to.meta.requireAuth) { 
    if (authUser && authUser.access_token) { 
     next(); 
    } 
    else { 
     next("login") 
    } 
} 
next(); 
}); 

로그인 한 후 다시 클릭하십시오. 아직 로그인 페이지인증 후 로그인 페이지에 액세스하지 못하게하는 방법 vuejs2

+0

당신이 대신 일하고자하는 로컬 스토리지 브라우저에 저장되어있는 토큰은이

created(){ const authUser =window.localStorage.getItem("authUser"); if (authUser){ this.$router.push("/Dashboard") } } 

처럼 "생성"수명주기 후크를 사용하여 보여줍니다? – Daniel

답변

-1

내가 AUTHUSER이