Presented below is the code that I have managed to successfully get working:
<span v-for="(item, index) in storedUserItems">
<template v-if="item.strength">
<img @mouseover="itemInfo(item, index)" style="padding: 5px;background: black;border-radius: 5px;margin-top: 15px;margin-right: 15px;" :src="require('../assets/items/strength/'+item.img)">
<span>{{itemPower}}</span>
</template>
</span>
The issue at hand arises when hovering the mouse over the img
, causing all item powers to be displayed alongside them. The goal is to only display the specific item info on which the mouse hovers. How can this problem be resolved?
Solution Approach:
methods: {
itemInfo(item, index) {
this.itemPower = item.power;
},