1
I have a styling problem in Vuejs. Through the v-get picked up 3 buttons of the API, so far so good. What I need is that when you click one of the 3 buttons it simply changes the color. When I try to make this color transition in ONE button, everyone is affected ! I wanted an idea of how to do, remembering that the buttons are not 'separate' type: < button > < button > < button >
<div class="form-group">
<label htmlFor="RequerenteId">Tabela</label>
<div name="requerente">
<button class="botaoBusca" v-for="item in tabela" :key="item.id" :value="item.id" v-on:click="filtraSelectBusca(item.id), isActive = !isActive" :class="{ 'btn-success': !isActive, 'btn-outline-danger': isActive }" >{{item.descricao}}
</button>
</div>
</div>
Anyway, I need to figure out a way to apply styling to just one button, using the date-v-xxxxx sei la .. If you have anything related or idea of solution, I will be grateful !!
Your problem is that the 3 buttons use the same variable to define whether they are "Success" or not. That is, if
isActive === true
the 3 buttons will receive the classbtn-success
because it is programmed to do so. You would have to have oneisActive
for each button to work the way you want it to.– fernandosavio