v-on vue code example

Example 1: @keyup.enter vue

<input v-on:keyup.enter="submit">
<!-- Also works like this: -->
<input @keyup.enter="submit">

Example 2: vue render html raw

<p>Using mustaches: {{ rawHtml }}</p>
<p>Using v-html directive: <span v-html="rawHtml"></span></p>

Example 3: 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 4: vue js button click

<div id="example-2">
  <!-- `greet` is the name of a method defined below -->
  <button v-on:click="greet">Greet</button>
</div>

Example 5: v-for

<ul>
  <li v-for="(item, index) in items">
    {{ index }} - {{ item }}
  </li>
</ul>

Example 6: v-for

<li v-for="item in items" :key="item.message">
    {{ item.message }}
  </li>

Tags:

Html Example