Thedifferencebetweenthis.$store.dispatch()andthis.$store.commit()methodsIngeneralthey只是访问方式不同,两种方式都是将值传递给vuex的mutation来改变statethis.$store.dispatch():包含异步操作,比如向后台提交数据,写成:this.$store.dispatch('actionmethodname',value)this.$store.commit():同步操作,写法:this.$store.commit('mutationsmethodname',value)commit:同步操作storethis.$store.commit('changeValue',name)取值this.$store.state.changeValuedispatch:异步操作storethis.$store.dispatch('getlists',name)取值this.$store.getters.getlists————————————————版权声明:本文为CSDN博主“BruceWu_”原创文章,遵循CC4.0BY-SA版权协议,转载请附上原文出处链接和d本声明为转载。
