v-on vuejs code example

Example 1: vue js data bind

// with v=bind
 <p><a v-bind:href="website">Text goes here fo the link </a> </p> 

//or with :
 <p><a :href="website">Text goes here fo the link </a> </p>

//website is variable/property with link in a Vue instance

Example 2: event vueks

<div id="example-3">
  <button v-on:click="say('salut')">Dire salut</button>
  <button v-on:click="say('quoi')">Dire quoi</button>
</div>

Example 3: event vueks

new Vue({
  el: '#example-3',
  methods: {
    say: function (message) {
      alert(message)
    }
  }
})

Example 4: vuejs v-on

<div v-on:javascriptEvent = "method"></div>

<!-- v-on:click <=> @click -->

Tags:

Html Example