this.store.commit()方法的区别总的来说他们只是存取方式的不同,两个方法都是传值给vuex的mutation改变state
this.store.dispatch(‘action方法名’,值)
this.store.commit(‘mutations方法名’,值)
commit: 同步操作
this.$store.commit('changeValue',name)
this.$store.state.changeValue
dispatch: 异步操作
this.$store.dispatch('getlists',name) // 存值
this.$store.getters.getlists // 取值
原文链接:
参考链接:
1.www.jianshu.com/p/c252761de…
2.blog.csdn.net/u014635374/…