有没有办法在 nuxt.config.js 中添加 beforeResolve 导航守卫?
我的 nuxt.config.js
module.exports {
...
router: {
beforeResolve(to, from, next) {
if (this.$store.getters.isLoggedIn)
next('/resource')
}
}
...
}
Run Code Online (Sandbox Code Playgroud)
但它永远不会被调用!
我一直在尝试根据 vuex 商店上的用户登录状态在安装组件之前实现重定向。