vuejs 3 code example

Example 1: vue 3

<script src="https://unpkg.com/vue@next"></script> # CDN Version

# NPM or Yarn Version
npm install vue@next

#Vue 3 CLI Installation
yarn global add @vue/cli
# OR
npm install -g @vue/cli

# Vue CLI Create Project
vue create my-project

Example 2: vuejs

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

Example 3: vue js documentation

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

Example 4: vuejs

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

Example 5: vue js

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

Example 6: vuejs

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