mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +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'
|
||||||
state: {
|
|
||||||
counter: 0
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
increment (state) {
|
|
||||||
state.counter++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
export default store
|
const createStore = () => {
|
||||||
|
return new Vuex.Store({
|
||||||
|
state: {
|
||||||
|
counter: 0
|
||||||
|
},
|
||||||
|
mutations
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
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