index.js 559 B

123456789101112131415161718192021222324252627282930313233
  1. import { createStore } from 'vuex'
  2. import * as getters from './getters'
  3. import * as actions from './actions'
  4. import * as mutations from './mutations'
  5. const state = {
  6. test: 0,
  7. count: 0,
  8. history: []
  9. }
  10. const store = createStore({
  11. state,
  12. getters,
  13. actions,
  14. mutations
  15. })
  16. if (module.hot) {
  17. module.hot.accept([
  18. './getters',
  19. './actions',
  20. './mutations'
  21. ], () => {
  22. store.hotUpdate({
  23. getters: require('./getters'),
  24. actions: require('./actions'),
  25. mutations: require('./mutations')
  26. })
  27. })
  28. }
  29. export default store