Answer the question
In order to leave comments, you need to log in
How to shorten "this" miracle, or make it easier?
Good evening, night, day, ladies and gentlemen.
There is data in which:
twoActive: false,
isActive: false,
twoact(){
this.isActive = false
this.twoActive = true
},
wtactiv(){
this.twoActive = false
this.isActive = true
},
<h1 class="static fir" @click="wtactiv" v-bind:class="{ actived: isActive }">первое</h1>
<h2 class="static sec" @click="twoact" v-bind:class="{ actived: twoActive }">второе</h2>
Answer the question
In order to leave comments, you need to log in
Create an array of states and reset the state for unselected elements (this is if something like a list of checkboxes). Else just keep an array and the index of the selected element.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question