[Vuejs]-Use VueJs local file instead of importing it

0👍

If you intend to use Vue in the file appJS.js, you will need to first import the vue.js before your file. here is how your files should look like :

App.js

window.onload = function () {
    var app = new Vue({
        el: '#app',
        data: {
            message: 'hello vue'
        }
    });
}

Index.html

<!DOCTYPE html>
<html>
<head>
<script src="./scripts/vue.js"></script>
<script src="./scripts/app.js"></script>
<title>Vue Test</title>
</head>
<body>
<div id="app">
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
  <p>{{ message }}</p>
</div>

</body>
</html>

Leave a comment