vue store存储commit 和dispatch的区别

dispatch:含有异步操作,

存储:

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

取值:

 

this.$store.getters.TargetUser

 

 

commit:同步操作,

存储:

 

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

 

取值:

 

this.$store.state.TargetUser
posted @ 2020-01-02 12:27  Tommy_marc  阅读(3209)  评论(0编辑  收藏  举报