vuex中使用commit 与dispatch

vuex中,如果不想引入mapMutations或者mapMutations,可以分别用commit 与dispatch 代替

commit 同步操作 this.$store.commit('mutations的方法',paramas)

dispatch 异步操作 this.$store.dispatch('actions的方法',paramas)

你可能感兴趣的:(vue)