Search code examples
javascriptvue.jsvuejs2vue-component

Is there a v-cloak inverse?


According to VueJS documentation, v-cloak "directive can be used to hide un-compiled mustache bindings until the Vue instance is ready.". In other word, I can hide a div or something like that, and it will be displayed when vue is ready.

Does VueJS provides its inverse? Something that hides until VueJS is ready?


Solution

  • As simple as:

    <div v-if="false">Will be visible until vue is mounted/ready...</div>
    

    Work for all versions.

    The element has to be inside your container... if you use to hide your master container, change it that way:

    <div id="app">
        <div v-if="false">Visible while loading...</div>
        <div v-cloak>Visible when ready...</div>
    </div>