javascript - Vue JS and model binding in tables -
why not possible bind model via v-model within table this:
<table class="table"> <thead> <th>select</th> <th>responder id</th> <th>heading 2</th> </thead> <tbody> <tr v-for="responder in responders"> <td v-model="selected" @click="selectresponder(responder)"><span class="glyphicon glyphicon-bullhorn"></span></td> <td>@{{ responder.userreference }}</td> </tr> </tbody> </table>
i want achieve, when user clicks glyphicon in table row, selected element bind variable in javascript.
v-model
used bind variable type of form input, , doesn't apply <td>
element. @click method can describing though:
//in vue instance ... methods:{ selectresponder(responder){ //either... responder.selected = true; //or maybe... this.selected = responder; } } ...
Comments
Post a Comment