Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

Vue.js | v-text directive

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The v-text directive is a Vue.js directive used to update a element’s textContent with our data. It is just a nice alternative to Mustache syntax. First, we will create a div element with id as app and let’s apply the v-text directive to this element with data as a message. Now we will create this message by initializing a Vue instance the data attribute containing our message.



Parameters: This directive accepts a single parameter which is the data.
Example: This example uses VueJS to update the text of a element with v-text. 


<!DOCTYPE html>
        VueJS | v-text directive
    <!-- Load Vuejs -->
    <script src=
    <div style="text-align: center;width: 600px;">
        <h1 style="color: green;">
            VueJS | v-text directive
    <div id="canvas" style="border:1px solid #000000;
                            width: 600px;height: 200px;">
        <div v-text="message" id="app">
        var app = new Vue({
            el: '#app',
            data: {
                message: 'Hello this is GeeksforGeeks.'


My Personal Notes arrow_drop_up
Last Updated : 25 Jun, 2020
Like Article
Save Article
Similar Reads
Related Tutorials