在登录页用localStorage存储用户信息,登录到首页后获取不到用户信息,需要刷新问题
因从登录页通过this.$router.push(’/home’) 跳转至首页,APP.vue的created函数不再执行,因此要在App.vue页面监听路由,获取用户信息
在这里插入图片描述
watch: {
KaTeX parse error: Expected '}', got 'EOF' at end of input: …rCache2 = this.store.state.userInfo;
if (userCache || this.KaTeX parse error: Expected '}', got 'EOF' at end of input: …Cache) || this.store.state.userInfo;
}
}
},

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐