store.js 文件中:
state:{ value:'' } mutations:{ changeValue(){ state.value = newVal } }
.vue 文件:
// 存 this.$store.commit('changeValue',1) // 取 console.log(this.$store.state.value)