I am trying to build a little project in Vue.js, I have defined a child component which a parent component has six instances of.
The child component has a div element:
<div class="player" id="player1">
and a function which will change its own opacity:
changeOpacity(){document.getElementById('playerName').style.opacity = 0.5;}
The problem is when I tell the second instance of child component to execute its function, the first instance of child will change opacity.
My suspicion is it has something to do with unique div id's, that is by creating multiple instances of the child component the id: playerName is no longer unique.
Does anyone have a suggestion for how a child instance can access its own component elements without interfering with other instances of itself?