dispatch:含有异步操作,

存储:

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

取值:

 

this.$store.getters.TargetUser

 

 

commit:同步操作,

存储:

 

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

 

取值:

 

this.$store.state.TargetUser

相关文章: