<input v-model="getVal" />
computed: {
getVal: {
get() {
// 这里也是用了Vuex里的 modules 大家可以当成普通的变量来看
return this.$store.state.Root.value
},
set(newVal) {
this.$store.commit('handleVal', newVal)
}
}
}
复制代码 // store.js
mutations: {
handleVal(state, payload) {
state.value = payload
}
}
复制代码详细地址
版权声明:本文为m0_63327154原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。