Event Handling in VueJs

A simple event handling demo in VueJs using the v-on:* directive - http://coligo.io

by urbycoz

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<div id="vue-instance">
  <p>{{ message }}</p>
  <button v-on:click="sayHello">Hey there!</button>
</div>

JavaScript

var vm = new Vue({
  el: '#vue-instance',
  data: {
    message: 'Hello Vue.js!!!'
  },
  methods: {
    sayHello: function(){
      alert('Hey there, ' + this.name);
    }
  }
});