Vuejs Input Binding Based On Array Of Computed Properties
I have a scenario where I want the v-model binding of an Input field to be decided by the value returned by a computed property. Please see the example below:
Solution 1:
You can v-model directly to a computed property without using data or set/get.
<input type="text" v-model="myName.first">
data:{},
computed: {
myName: function() {
returnthis.$store.state.myName; //or whatever your api is
}
}
Also, make sure the value of your computed property is present before your input loads.
Post a Comment for "Vuejs Input Binding Based On Array Of Computed Properties"