Answer the question
In order to leave comments, you need to log in
How in vue.js on click on an element to add an attribute to it from a method?
<a v-on:click="click_page( this )" v-else href="javascript:void(0)" >{{page.page}}</a>
methods : {
click_page : function ( e ) {
console.log( e )
}
}
Answer the question
In order to leave comments, you need to log in
template
js
methods : {
click_page(e){
console.log(e)
e.target.setAttribute("attributeKey", "attributeValue")
}
}
It's not entirely clear what you want.
If you get event into a function on click, then simply:
Or
Or
<a v-on:click="click_page($event)" href="javascript:void(0)">{{page.page}}</a>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question