index.js 548 B

1234567891011121314151617181920212223242526272829303132
  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. count: 0,
  7. history: []
  8. }
  9. const store = createStore({
  10. state,
  11. getters,
  12. actions,
  13. mutations
  14. })
  15. if (module.hot) {
  16. module.hot.accept([
  17. './getters',
  18. './actions',
  19. './mutations'
  20. ], () => {
  21. store.hotUpdate({
  22. getters: require('./getters'),
  23. actions: require('./actions'),
  24. mutations: require('./mutations')
  25. })
  26. })
  27. }
  28. export default store