Answer by sxzzz for Vue accessing Vuex store in router file
I have similar situation.import store from "../store"; to routerthen I can use store's API (commit etc ) inside router.beforeEach
View ArticleAnswer by Edouard Yonga for Vue accessing Vuex store in router file
maybe is because the before route load before the importstry to import it directly from the before route:router.beforeEach(function (...) { const store = require('./store') store.blah... })
View ArticleVue accessing Vuex store in router file
I am trying to access my store in the router file as follow, but it's not working. Giving me undefined when I console. Any advice? I am using Vue 3. Thank you in advance!import store from...
View Article
More Pages to Explore .....