mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
Use 2 files for normal store
This commit is contained in:
parent
b68033a3b8
commit
e95c0a6573
@ -1,14 +1,14 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
import mutations from './mutations'
|
||||||
|
|
||||||
|
const createStore = () => {
|
||||||
|
return new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
counter: 0
|
counter: 0
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations
|
||||||
increment (state) {
|
|
||||||
state.counter++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default store
|
export default createStore
|
||||||
|
7
examples/vuex-store/store/mutations.js
Normal file
7
examples/vuex-store/store/mutations.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const mutations = {
|
||||||
|
increment (state) {
|
||||||
|
state.counter++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default mutations
|
Loading…
Reference in New Issue
Block a user