Answer the question
In order to leave comments, you need to log in
How to add active class on button click?
Good afternoon!
I'm still new to vue, so I'm asking for your help and advice.
Task:
1. add an active class to the block by clicking on the button
2. when you click on the button again, or in another part of the body , hide the block (remove the class)
Conditions:
1. There is a button that has the following structure:
<button id="toggle" type="button" @click="show"></button>
<div id="bar" :class="active: isActive"></div>
@click="show"
should activate :class="active: isActive"
. But I don't understand how to combine button and block. 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