vue-router使用beforeEach钩子获取vuex里的state值,初始页面报错,如何解决?
router.beforeEach((to, from, next) => {
console.log(router.app.$store.state.isLogin)
if(!userinfo && to.path.indexOf('login') == -1){
return next('/login')
}else{
return next()
}
});
陪伴而非守候
相关分类