Reputation: 1472
I have object with elements and I use v-for loop to dispaly them on page:
<template v-for="(item, index) in myObject">
<v-row :key="index">
<v-col>
<v-text-field
v-model="item.value"
:label="item.name"
/>
</v-col>
</v-row>
</template>
<!-- additional TextField -->
<v-row>
<v-col>
<v-text-field
v-model="modifyDateTime"
label="Modify date and time"
/>
</v-col>
</v-row>
It works fine, but I added additional v-text-field below after v-for block and it shows up earlier than elements in v-for loop rendered.
How can I solve this problem? I need to display the last v-text-field element right after elements v-for loop was rendered
Upvotes: 0
Views: 77
Reputation: 26
use v-if in loop
<template v-for="(item, index) in myObject">
<v-row :key="index">
<v-col>
<v-text-field
v-model="item.value"
:label="item.name"
/>
</v-col>
</v-row>
<!-- additional TextField -->
<v-row v-if="index == Object.keys(item).length - 1">
<v-col>
<v-text-field
v-model="modifyDateTime"
label="Modify date and time"
/>
</v-col>
</v-row>
</template>
Upvotes: 1