index.js 577 B

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