vue store存储commit 和dispatch的区别

dispatch:含有异步操作,

存储:

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

取值:

this.$store.getters.TargetUser

commit:同步操作,

存储:

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

取值:

this.$store.state.TargetUser
原文地址:https://www.cnblogs.com/tommymarc/p/12132279.html