[Vuejs]-How to make Vue app in javascript and make it work in html?

0👍

Here is a basic template of vuejs 2 using html and javascript, without node.

You must call Vue constructor and set the el value to some tag id.

new Vue({
  el: "#notes-app",
  data: {
    counter: 0
  },
  methods: {
    increment() {
      this.counter++;
    }
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="notes-app">
  {{ counter }}
  <button v-on:click="increment">increment</button>
</div>

Leave a comment