Vue.js Declarative Rendering (original) (raw)

Last Updated : 11 Feb, 2021

Vue.js is a progressive framework for building user interfaces. The core library is focused on the view layer only and is easy to pick up and integrate with other libraries. Vue is also perfectly capable of powering sophisticated Single-Page Applications in combination with modern tooling and supporting libraries.

Declarative rendering in Vue enables us to render data to the DOM using straightforward template syntax. Double curly braces are used as placeholders to interpolate the required data in the DOM.

The below examples demonstrate declarative rendering in Vue.js:

Example 1:

Filename: index.html

HTML `

Welcome to the exciting world of {{name}}

`

Filename: app.js

JavaScript `

const parent = new Vue({ el : '#parent', data : {

    // The data that will be
    // interpolated in the DOM
    name : 'Vue.Js'
}

})

`

Output:

Declarative Rendering

Example 2:

Filename: index.html

HTML `

Different Frameworks and Libraries in Javascript

`

Filename: app.js

JavaScript `

const parent = new Vue({ el : '#parent', data : {

    // The data that will be
    // interpolated in the DOM
    priority1: "vue.js",
    priority2: "React.js",
    priority3: "Angular.js"
}

})

`

Output:

Declarative rendering

Similar Reads

Basics







































Transition




Directives
























Filters





Routing



Difference Between