I have the following code snippet:
<tr>
<td @click="changeTeam('WHU')">WHU</td>
<td>20 Oct</td>
<td @click="changeTeam('BHA')">BHA</td>
</tr>
<tr>
<td @click="changeTeam('CHE')">CHE</td>
<td>21 Oct</td>
<td>WAT</td>
</tr>
and the following VueJS method:
methods: {
changeTeam(selection) {
this.team = selection;
}
}
So as you can see, I'm calling this function and passing in the value in the table cell (i.e. <td> tag) to change a selection. This works for me, but is there a way I can capture the contents of the table cell, by means of some other method? Something a little more reusable or would this just be introducing extra overhead?
The table itself is the result of a dynamically generated page, so I'm not overly bothered about the apparent duplication.