0
Use a getter for it, beforeCreate doesn’t matter here because the elements aren’t available anyway, so using a getter makes the most sense as it will fire only when the component is available:
computed: {
showNav() {
return User.checkAuth()
}
}
0
Alright, figured this out by calling window.location = '/'
in my User.js login method, rather than this.$router.replace('/')
in the login component’s login method. Timing is everything.
- [Vuejs]-How to access store in the mounted() method with NUXT.js?
- [Vuejs]-Create a category filter with vuejs method
Source:stackexchange.com