In VueJS we need to create Instance with new Vue. The syntax is given below:

var app = new Vue({
// options
})

Let us see a complete example with Vue Instance:

Output

Output

Explanation:

Vue Instance first has a parameter called el, so you have to put the id of your DOM element, that is, the id where you want to see the result. We put the Id named info in the el parameter here. And we have set this Id in our DOM element called div.

And the second parameter in Vue Instance is data. And as the name implies, here we have to keep the data i.e. the properties of Instance. We have three properties named first name, last name, and age.

And the last parameter of Vue Instance is the methods with which we can process the data and return a value. Here we have returned the process data of our method in my details.

 

Leave a Reply

Your email address will not be published. Required fields are marked *