vue store存储commit 和dispatch的区别

dispatch:含有异步操作,

存储:

this.$store.dispatch('setTargetUser',friend);

取值:

this.$store.getters.TargetUser

commit:同步操作,

存储:

this.$store.commit('setTargetUser',friend)

取值:

this.$store.state.TargetUser