When I was using vuex, I saw parameter destructuring used, but I was wondering, where did this commit come from? Where is the commit parameter provided? How is it written without simplification?
actions: { increment ({ commit }) { commit('increment') } }
actions: {
increment (context) {
context.commit('increment'),
},
ddd(context) {
context.commit('ddd'),
}
}
用参数解构之后:
actions: {
increment ({ commit }) {
commit('increment')
},
ddd({ commit }) {
commit('ddd')
}
}
The
vuex documentation