Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

v-cloak does not work in vue.js?

Tags:

vue.js

There is a div in my page that for show the error message.When I refresh the page,it will appear for a while then it disappear. I added v-cloak but it doesn't work.

this is the code, showErrorMsg is false

<div v-cloak v-show="showErrorMsg" style="z-index:100" class="h5_tips tips_error">   <a href="#" v-on:click="showErrorMsg = false" class="del"><i>&#xe906;</i></a>   <p v-text="errorMsg"></p> </div> 

How to fix this?

like image 324
Song Yongtao Avatar asked Jan 19 '16 07:01

Song Yongtao


People also ask

What is V cloak in Vue JS?

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.

Do you need CSS with Vue?

Before we move on to add more advanced features to our app, we should add some basic CSS to make it look better. Vue has three common approaches to styling apps: External CSS files.

Which of the following method does not represent the non mutation?

18) Which of the following method does not represent the non-mutation? Answer: A is the correct option. The Reverse() method does not represent the non-mutation.


1 Answers

Just include this code to your css file

[v-cloak] { display:none; } 

http://vuejs.org/api/#v-cloak

Usage example:

<div class="xpto" v-cloak>     Hello </div> 

This directive 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 un-compiled mustache bindings until the Vue instance is ready.

http://vuejs.org/api/#v-cloak

like image 110
Eduardo Stuart Avatar answered Sep 23 '22 16:09

Eduardo Stuart