Implementing an animated carousel has been my latest project, and I've been using code similar to the following:
<template>
<div v-for="(slides, id)" v-if="id > middle_id - 2 || id < middle_id + 2">
<div :class="'slide'+id"><slide :key="id" :slide-data="slide" /></div>
</div>
</template>
The number of slides can vary, but only the middle 5 are shown. The animations rely on css animation properties, which are based on the slide number.
This setup works smoothly if I add or remove slides individually - the existing DOM elements remain unchanged and only one new slide is introduced. However, when I simultaneously add a slide to the end and remove one from the beginning, Vue seems to re-render all of the DOM elements in the sliding window.
I'm wondering if there's a way to ensure that during this process, the 3 middle slides that haven't changed are not updated in the DOM?