Follow these instructions to create an auto-import of the vuex modules in your project that will handle the router files inside a specific folder:
- With our route files created and placed inside the store folder, we need to make sure that every store file has a default export object in it. In the index.js file, inside the src/store folder, we will need to extract the array of stores or modules:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export default new Vuex.Store({});
- Create another file named loader.js in the src/store folder (which will be our module loader). It's important to remember that when using this recipe, you will use vuex namespaced because all the stores need to be used as a module and need to be exported in a single JavaScript object. Each filename will be used as a reference to a namespace, and it will be parsed to a camelCase text style:
const toCamel = (s) => s.replace(/([-_][a-z])/ig, (c) =>
c.toUpperCase...