Store.commit

提交 mutation。 详细介绍

参数说明
参数 类型 必填 说明
type String 类型
payload any 载荷,传入的额外参数
示例
// store.js
import createStore from 'chameleon-store'
const store = createStore({
  state: {
    count: 0
  },
  mutations: {
    increment (state) {
      state.count++
    }
  }
})
export default store

// app.js
store.commit('increment')

results matching ""

    No results matching ""