diff --git a/examples/vuex-store/store/index.js b/examples/vuex-store/store/index.js index 2d2d91a6ea..8172cac5d8 100644 --- a/examples/vuex-store/store/index.js +++ b/examples/vuex-store/store/index.js @@ -1,14 +1,14 @@ import Vuex from 'vuex' -const store = new Vuex.Store({ - state: { - counter: 0 - }, - mutations: { - increment (state) { - state.counter++ - } - } -}) +import mutations from './mutations' -export default store +const createStore = () => { + return new Vuex.Store({ + state: { + counter: 0 + }, + mutations + }) +} + +export default createStore diff --git a/examples/vuex-store/store/mutations.js b/examples/vuex-store/store/mutations.js new file mode 100644 index 0000000000..e85cce517e --- /dev/null +++ b/examples/vuex-store/store/mutations.js @@ -0,0 +1,7 @@ +const mutations = { + increment (state) { + state.counter++ + } +} + +export default mutations \ No newline at end of file