vue.js javascript code example

Example 1: vuejs

var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue!'
  }
})

Example 2: vue js

<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

Example 3: vuejs

<div id="app-2">
  <span v-bind:title="message">
    Hover your mouse over me for a few seconds
    to see my dynamically bound title!
  </span>
</div>

Example 4: vuejs

const CounterApp = {
  data() {
    return {
      counter: 0
    }
  },
  mounted() {
    setInterval(() => {
      this.counter++
    }, 1000)
  }
}

Tags: