this.$store.dispatch() 与 this.$store.commit()方法的区别
传值给vuex的mutation改变state
commit: 同步操作
存储
this.$store.commit('changeValue',name)
取值
this.$store.state.changeValue
dispatch: 异步操作
存储
this.$store.dispatch('getlists',name)
取值
this.$store.getters.getlists
原创
2020-06-17 09:51:37 ·
1038 阅读 ·
0 评论