{
path: '/login',
name: 'Login',
component: Login,
meta: { requiresAuth: false }
},
//---------------
router.beforeEach((to, from, next) => {
if(!to.matched[0]){
router.push({ name: 'Login' });
}else if(to.meta.requiresAuth){
S.currentUser ? next() : router.push({ name: 'Login' })
}
}else{
next();
}
});
{ path: '/lk', name: 'Lk', component: Lk, meta: { requiresAuth: true } }
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth)) {
if (!store.state.account.access) {
next({ name: 'Signin' })
} else {
next()
}
} else {
next()
}
})