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
Add the block data into an array, add a property to each array element that will be responsible for displaying content:
data: () => ({
items: [
{ show: true, ... },
{ show: true, ... },
...
],
}),
<template v-for="(n, i) in items">
<button @click="n.show = !n.show">{{ n.show ? 'hide' : 'open' }}</button>
<div class="list" v-show="n.show">
...
</div>
<hr v-if="i !== items.length - 1">
</template>
With v-for, I know how, but without it, in any way?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question