NuxtN
Nuxt2y ago
isakwang

v-for where v-if only affects one element

Hello

Not sure how to google for this so asking here. I have a list of elements with an @click directive and a v-if that toggles some elements within the parent. Currently im using a single ref, but that means all off them expand when one is clicked instead of that one. How can I fix this

Example
<div v-for="item in list" @click="expand"> <h1>{{item.label}}</h1> <p v-if="expand">{{ item.description }}</p> </div>
Was this page helpful?