You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
454 B
29 lines
454 B
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
import * as actions from './actions'
|
|
import * as getters from './getters'
|
|
|
|
Vue.use(Vuex)
|
|
|
|
// 应用初始状态
|
|
const state = {
|
|
count: 10
|
|
}
|
|
|
|
// 定义所需的 mutations
|
|
const mutations = {
|
|
INCREMENT(state) {
|
|
state.count++
|
|
},
|
|
DECREMENT(state) {
|
|
state.count--
|
|
}
|
|
}
|
|
|
|
// 创建 store 实例
|
|
export default new Vuex.Store({
|
|
actions,
|
|
getters,
|
|
state,
|
|
mutations
|
|
})
|