When I look at the code snippet below, I find myself facing an issue with state usage.
<div class="featured-card-container">
<swiper class="swiper" :options="swiperOption">
<template v-for="(strategy, index) in strategiesCards">
<swiper-slide :key="'slider-' + index">
<strategy-card
:data="strategy"
@click.native="showModalStrategies()"
/>
</swiper-slide>
<strategies-modal
:key="'modal-' + index"
:dialog.sync="modalStrategies"
:data="strategy"
/>
</template>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
The main challenge here is triggering a modal from its corresponding card. Figuring out how to accomplish this effectively has been quite daunting for me.
The current strategy implemented in the above code seems to be causing issues because the data state modalStrategies
is shared across multiple components. This results in all existing modals being quickly changed even if only one card is clicked.
I'm seeking guidance on how to resolve this dilemma. Are there any workarounds or solutions that could address this issue effectively?
Thank you to everyone who takes the time to understand and provide input on my situation. Your efforts are truly appreciated.