Passing A Dynamic V-model As Function Param
I am very new to vuejs, and I am working with making a dynamic table where the left column will have a hidden input that will ultimately query a database and display the result in
Solution 1:
Ordinarily, the method bound to a click
will get the event, but you can pass whatever you want it to get (include $event
if you want to add that to other arguments).
When you say you want to "bind v-models", I take it to mean you want to pass the current data.
newVue({
el: '#app',
data: {
rows: [{
share_id: 'IT ME'
},
{
share_id: 'THE OTHER ONE'
}
]
},
methods: {
getSub(data) {
console.log("Working with", data);
}
}
});
<scriptsrc="//cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js"></script><divid="app"><divv-for="tableRow in rows"><inputname="tableRow.share_id"v-model="tableRow.share_id"value="tableRow.share_id">{{ tableRow.share_id }}
<buttonv-on:click="getSub(tableRow.share_id)">view</button></div></div>
Post a Comment for "Passing A Dynamic V-model As Function Param"