When hovering over a card, all icons are displayed instead of just the icons for that specific card. I want to show only the icons for the card being hovered on (example output: image). The cards are generated automatically using v-for and fetching data from the axios package. The responsibility of DisplayNotes.vue file is to display notes in the cards to the user. Can someone help me resolve this issue?
[DisplayNotes.vue]
<template>
<div class="main-section">
<div v-for="note in notes" :key="note.data" class="container">
<div class="card-content">
<h5>{{note.title}}</h5>
<p><i>{{note.body}}</i></p>
</div>
<div @mouseover="hover=true" @mouseleave="hover=false" class="import-icons">
<icons v-if="hover" />
<button type="button" @click="handlesubmit()">close</button>
</div>
</div>
</div>
</template>
<script>
import service from '../service/User'
import icons from './icons'
export default {
components: {
icons
},
data() {
return {
hover: false,
notes: [{
id: 1,
title: 'Fundoo',
body: 'unlimited Notes...'
}, ],
}
},
methods: {
async handlesubmit() {
const response = await axios.get('/displayNotes', {});
localStorage.getItem('token', response.data.token);
this.notes.push(response.data);
},
}
}
</script>
<style lang="scss">
.card-content {
input {
border: none;
}
textarea {
border: none;
outline: none;
}
}
/* dividing the width percentage */
.container {
height: 200px;
width: 25%;
float:left;
margin: -2.98%;
margin-left:20%;
margin-top: 5%;
border-style: ridge;
}
.import-icons {
display: block;
margin-left: -2%;
padding-top: 25%;
button {
border: none;
background: none;
float: right;
font-weight: 600;
font-family: Arial, Helvetica, sans-serif;
margin-top: -2%;
padding-left: 400px;
}
}
</style>
[icons.vue]
<template>
<div class="used-icons">
<i id="first-icon" class="fas fa-bell"></i>
<i id="second-icon" class="fas fa-user"></i>
<i id="third-icon" class="fas fa-palette"></i>
<i id="forth-icon" class="fas fa-archive"></i>
<!-- <i id="fifth-icon" class="fas fa-ellipsis-v"></i> -->
</div>
</template>
<style scoped>
#first-icon {
opacity: 0.9;
}
#second-icon {
padding-left: 30px;
padding-right: 30px;
opacity: 0.9;
}
#third-icon {
opacity: 0.9;
}
#forth-icon {
padding-left: 30px;
padding-right: 30px;
opacity: 0.9;
}
#fifth-icon {
padding-right: 195px;
opacity: 0.9;
}
</style>