【发布时间】:2019-04-03 09:37:34
【问题描述】:
从阅读the docs 开始,我需要添加一个双向计算属性来将数据从我的表单绑定到存储。但我需要绑定到对象上的一个项目:
checked: {
'football': [],
'tennis': [],
'rugby': [],
},
计算不足:
testBinding: {
get () {
return this.$store.state.Sports.checked;
},
set (value) {
this.$store.commit('Sports/checked', value);
}
},
在我的循环出复选框内:
<input type="checkbox" :value="option.id" v-model="testBinding">
当football 需要在绑定中动态设置时,我如何绑定到商店中的football 之类的东西,例如v-model="testBinding[key]" 之类的东西
【问题讨论】: