vuex存储

vuex有两种存储方式 commit 和dispatch

commit属于同步操作

存储

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

取值

this.$store.state.存的名字

dispatch属于异步操作

存储

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

取值

this.$store.getters.存的名字

 

posted @ 2021-01-20 10:48  宸泽岚  阅读(217)  评论(0编辑  收藏  举报