Working with Vue I have encountered a problem.
I want to display a list of materials in a swiper dynamically.
My problem comes from not being able to do an if around the div that contains the swiper-slide class or its closure.
Currently my code is as follows:
<div class="material-list swiper-container">
<div class="swiper-wrapper">
<template v-for="(material, index) in materials">
<div class="swiper-slide">
<div class="material">
<p>{{material.title}}</p>
<p>{{material.year}}</p>
<p>{{material.category}}</p>
</div>
</div>
</template>
</div>
</div>
and I would like to get something like this:
<div class="material-list swiper-container">
<div class="swiper-wrapper">
<template v-for="(material, index) in materials">
{{ if index == 0 }}
<div class="swiper-slide">
{{/if}}
<div class="material">
<p>{{material.title}}</p>
<p>{{material.year}}</p>
<p>{{material.category}}</p>
</div>
{{ if index == 5 }}
</div>
{{/if}}
</template>
</div>
</div>