9951 explained code solutions for 126 technologies


vue.jsHow can I get Vue.js to work in Chrome?


To get Vue.js to work in Chrome, you need to do the following:

  1. Include the Vue.js library in your HTML page.

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  2. Create a new Vue instance, and define the data and methods you want to use.

    <script>
    new Vue({
    el: '#app',
    data: {
      message: 'Hello Vue!'
    },
    methods: {
      sayHello: function() {
        alert(this.message);
      }
    }
    });
    </script>
  3. Create an HTML element to hold the Vue instance.

    <div id="app">
    {{ message }}
    <button @click="sayHello">Say Hello</button>
    </div>
  4. Open the HTML page in the Chrome browser.

  5. You should see the output of the Vue instance in the browser window.

Helpful links

Edit this code on GitHub