mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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'
|
||||
|
||||
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
|
||||
|
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