Answer the question
In order to leave comments, you need to log in
How to solve a problem in VueJs2?
Hello!
I have a few questions about Vu...those who are pros on Vu, advise the best solution
so
in Vu how to work on elements (like jQuery)
for example<button @click="myFunc">button</button>
methods:{
myFunc(e){
// code
},
}
<div>
<myButton @click="isClass = !isClass" :class="{'active':isClass}"></myButton>
<myButton @click="isClass = !isClass" :class="{'active':isClass}"></myButton>
<myButton @click="isClass = !isClass" :class="{'active':isClass}"></myButton>
<myButton @click="isClass = !isClass" :class="{'active':isClass}"></myButton>
</div>
data:{
isClass: false,
}
Answer the question
In order to leave comments, you need to log in
1. Access to the dom element:
myFunc(e){
var element = e.target
},
when working with some data, where to save the best option? in cookies or in localStorage?- wherever you want
when clicking on the buttons, the class of the element changes, but on all the buttons
, what needs to be done to change the class of only those that we clicked?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question