Answer the question
In order to leave comments, you need to log in
How to change the styles of elements in vue when clicking on the parent?
I have this toggle switch to switch languages
<div class="lang-changer">
<div class="lang-tog"><span id="current-lang">РУ</span><span class="lang-tog-circle"></span></div>
</div>
Answer the question
In order to leave comments, you need to log in
<div class="lang-changer" @click="toggle = !toggle">
<div :class="toggle ? 'lang-tog': 'lang'">
<span :class="toggle ? 'a': 'b'">РУ</span>
<span :class="toggle ? 'x': 'y'"></span>
</div>
</div>
data(){
return {
toggle: false;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question