VUEX中的dispatch()和commit()

commit: 同步操作
存储

this.$store.commit('changeValue',name)

取值

this.$store.state.changeValue

 

dispatch: 异步操作
存储

this.$store.dispatch('getlists',name)

取值

this.$store.getters.getlists

  



posted @ 2020-04-08 18:31  donglt  阅读(26108)  评论(0编辑  收藏  举报