Events in vue js

Event handling in Vue is done with the v-on directive, so that we can make something happen when for example a button is clicked. Event handling is when HTML elements are set up to run a certain code when a certain event happens. Events in Vue are easy to use and will make our page truly responsive.

<template>
  <button class="btn" v-on:click="eventCall()">Click me</button>
</template>
<script>

  export default {
     name: "HeaderComponent",
     props: ['newArr'],
     methods: {
        eventCall(){
           alert('hi bhanje');
        }
     }
  }

</script>

Leave a Reply