-1👍
i think this should work
<template v-for="field in fields">
<custom-input v-model="computedValue"></custom-input>
</template>
<script>
export default {
data() {
return {
fields: [{'name': 'foo'}]
}
},
computed: {
foo: {
get() {
return this.$store.state.foo
},
set(value) {
return this.$store.commit('updateFoo', value)
}
},
computedValue(){
return this[this.fields.name] //or your dynamic variable
}
}
}
</script>
Source:stackexchange.com