Answer the question
In order to leave comments, you need to log in
How to make multiple styles/classes change on click?
For example, there is a code that changes the style of the list output by clicking on a button (icon):
<div id="app">
<button @click="active1 = !active1, active2 = !active2, active3 = !active3">поменять стиль списка</button>
<ul>
<li>
<div :class="{ active1 }"></div>
<div :class="{ active2 }"></div>
<div :class="{ active3 }"></div>
</li>
<ul>
</div>
new Vue({
el: '#app',
data() {
return {
active1: false,
active2: false,
active3: false
}
}
})
<li></li>
? <li></li>
- output from the array.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question