Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The first thing that came to mind, but I think there is a more effective option.
<table class="table">
<tr>
<td v-for="(user, index) in users" v-if="index !== users.length - 1">{{ user.name }}</td>
<td v-for="(user, index) in users" v-if="index === users.length - 1" @click="tabAction">{{ user.name }}</td>
</tr>
</table>
<td v-for="(user, index) in users" v-if="!isThisLastIndex(users, index)">{{ user.name }}</td>
<td v-for="(user, index) in users" v-if="isThisLastIndex(users, index)" @click="tabAction">{{ user.name }}</td>
...
isThisLastIndex(users, index) {
return index === users.length - 1
}
if you are not too lazy to generate a unique id for each element, then you will never have problems accessing any element at any time on any event, and your html code will be pristine and not clogged with all this rubbish
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question