Vue JS Basics (Questions/Answers) : Abhishek Chaturvedi

How to create an instance in Vue?

In VueJS, the application starts by creating a new Vue instance with this function :

<html>
<head>
<title>VueJs Instance</title>
<script type = "text/javascript" src = "js/vue.js"></script>
</head>
<body>
<div id = "app">
<h1>Name : {{name}}</h1>
<h1>Age : {{20}}</h1>
<h1>{{info()}}</h1>
</div>
<script type = "text/javascript" src = "js/vue_instance.js"></script>
</body>
</html>
var  vm = new Vue({
el: '#app',
data: {
name : "Abhishek Chaturvedi",
age : 20
},
methods: {
info : function() {
return "Hello, My name is "+this.name +" and my age is "+ this.age;
}
}
})

Technical Architect | Model | Actor | Photographer | Boxer