Skip to content
Related Articles

Related Articles

Improve Article

Vue.js v-cloak Directive

  • Last Updated : 09 Jul, 2020

The v-cloak directive is a Vue.js directive that will remain on the element until the associated Vue instance finishes compilation. Combined with CSS rules such as [v-cloak] { display: none }, this directive can be used to hide uncompiled mustache bindings until the Vue instance is ready. First, we will create a div element with id as app, and let’s apply the v-cloak directive to an element.


<element v-cloak></element>

Parameters: This function doesn’t accept any parameter.

Example: This example uses Vue.js to show the working of the data with v-cloak so that it becomes visible only when the compilation completes.


<!DOCTYPE html>
    <!-- Load Vuejs -->
    <script src=
        [v-cloak] {
            display: none;
    <div style="text-align: center;width: 600px;">
        <h1 style="color: green;">
            VueJS | v-cloak directive
    <div id="canvas" style=
            "border:1px solid #000000;
            width: 600px;height: 200px;">
        <div id="app" style=
            "text-align: center; 
            padding-top: 40px;">
            <h1 v-cloak>{{ data }}</h1>
        var app = new Vue({
            el: '#app',
            data: {
                data: 'GeeksforGeeks'


My Personal Notes arrow_drop_up
Recommended Articles
Page :