In my Vue.js application, I have created a list of objects where each object represents a star. I want to implement a feature where a star changes color when it is clicked.
However, the issue I am facing is that when I click on one star, all the stars in the list change color simultaneously.
To demonstrate this problem, I have created a dummy example on JSFiddle: https://jsfiddle.net/t3f0rpqh/21/
Although I intend to use Font Awesome icons for the stars, I am encountering the same problem. Whenever I click on one icon, all the icons in the list are affected, rather than just the one that was clicked.
<font-awesome-icon
:class="{ activeIcon: activeIcon}"
:icon="icon"
v-on:click="starLocation(item.id)"
/>
I am seeking guidance on how to bind each star/icon to a specific object or how to ensure that only the clicked star/icon changes color.
If anyone has any insights or solutions to offer, I would greatly appreciate it!
Thank you for your assistance!