vuex存储

vuex有两种存储方式 commit 和dispatch

commit属于同步操作

存储

this.$store.commit('存的名字',name)

取值

this.$store.state.存的名字

dispatch属于异步操作

存储

this.$store.dispatch('存的名字',name)

取值

this.$store.getters.存的名字

原文地址:https://www.cnblogs.com/huichaoboke/p/14301653.html