In my vuex setup, I have split files for getters, mutations, actions, and state. I recently switched to using Quasar which suggests organizing the Vuex module in this way. Although I used to have them all in one file before, I decided to give this a try. Here is my folder structure:
└── store
└─ routes
├── state.js
├── actions.js
├── mutations.js
├── getters.js
└── index.js
In the index.js file, everything is imported and bound together like this:
import state from './state'
import * as getters from './getters'
import * as mutations from './mutations'
import * as actions from './actions'
export default {
namespaced: true,
getters,
mutations,
actions,
state
}
Within getters.js, I export my previously used functions. However, I encountered an issue where I needed to access the $route plugin within one of them.
export const current_route = state => {
return this.$route;
}
While I am aware that I can directly use this.$route without going through the getter, I wanted to understand if it's possible to access these variables within the splitted files.