0👍
✅
Replaced the data and method with a computed property and it seems as though it’s fixed the issue.
computed: {
...mapGetters(["watchedItems"]),
watched: function() {
return this.watchedItems.find(i => {
return i.id === this.item.id ? true : false;
});
}
},
1👍
the event handlers should be separated by ;
like :
<img
src="svg/eye-regular.svg"
v-if="!watched"
@click="addToWatched(item); isWatched(item); log()"
/>
<img
src="check-solid.svg"
v-if="watched"
@click="removeFromWatched(item); isWatched(item); log()"
/>
Source:stackexchange.com