index.js 514B

1234567891011121314151617181920212223242526
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. import { storeAuthPlugin } from '@/util/auth-plugin'
  4. Vue.use(Vuex)
  5. const store = new Vuex.Store({
  6. plugins: [storeAuthPlugin],
  7. state: {
  8. },
  9. mutations: {
  10. }
  11. })
  12. export const modules = {
  13. user: () => require('./user/index').default,
  14. index: () => require('./index/index').default
  15. }
  16. Object.keys(modules).forEach(modKey => {
  17. const modNS = modKey.split('/')
  18. const getMod = modules[modKey]
  19. store.registerModule(...modNS, getMod())
  20. })
  21. export default store