Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 938
rap-2-h Avatar asked Oct 11 '17 07:10

rap-2-h


2 Answers

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>
like image 185
Willem Franco Avatar answered Oct 21 '22 02:10

Willem Franco


There plenty of solutions, I think another one will be to use v-if with a false property in data like:

<div v-if="false">Loading Vue....</div>
<div v-cloak>vue loaded</div>
like image 20
Stefano Nepa Avatar answered Oct 21 '22 04:10

Stefano Nepa