Categories

Oct 21, 2019 in Vue.JS
Q:

How do you use event handlers?

1 Answer

Oct 21, 2019

You can use event handlers in vue similar to plain javascript. The method calls also support the special $event variable.

<button v-on:click="show('Welcome to VueJS world', $event)">
  Submit
</button>

methods: {
  show: function (message, event) {
    // now we have access to the native event
    if (event) event.preventDefault()
    console.log(message);
  }
}
Click here to read more about Vue JS
Click here to read more about Insurance

Related questions

Madanswer
Oct 21, 2019 in Vue.JS
Oct 21, 2019 in Vue.JS
Oct 21, 2019 in Vue.JS
...