To get a clicked element with Vue.js 2 first add a method in your component. Note the comment in the code below.
methods: {
myFunction: (document, event) => {
// This gets the clicked element as jQuery
var $element = $(event.target);
}
}
Then simply pass document
and $event
via @click
.
<button @click="myFunction(document, $event)">Button</button>
