在vuex相关配置如下
const mutations = {
incrementment( state,payload ){
state.numb+= payload.amount;
},
reducement( state ){
state.numb-- ;
},
[SOME_MUTATION](){
state.numb+=10.98
}
}
const actions = {
actionIncrement({ commit }){
commit('incrementment')
}
}
const store = new Vuex.Store({
state,
getters,
actions,
mutations
})
然后在组件中调用
<button @click="actionHand()">Actions 按钮</button>
actionHand(){
this.$store.dispatch({
type:'actionIncrement',
amount:70
})
}
但是点击时候报错 Cannot read property 'amount' of undefined
求大佬解答