maybe this is a trivial question.
so, when I run my vuejs application on browser with enables throttling download speed (sets to low connection). I got unfinished vue syntax output in browser.
I know we can trick this out with showing loading image before entire page has loaded, but it's there any best solution to fix this?
As suggested by others using v-cloak is proper solution. However as @ DelightedD0D mentioned it IS clunky. Simple solution is to add some CSS in the pseudo selector
::before
ofv-cloak
directive.In your sass/less file something along the lines of
Of course you'd need to provide a valid and accessible path to loader image. It will render something like.
Hope it helps.
You can use the v-cloak directive, which will hide the Vue instance until the compilation finishes.
HTML:
CSS:
Yep, you can use
v-cloak
, I like use spinkit, is a great library with only CSS, check a simple example:Link: - http://tobiasahlin.com/spinkit/
I attached the following codepen. You can see the difference with and without
v-cloak
.http://codepen.io/gurghet/pen/PNLQwy
Using
v-cloak
directive you can hide un-compiled mustache bindings until vue instance is done compiling. You must use the CSS block to hide it until compiled.HTML:
CSS:
This
<div>
will not be visible until the compilation is completed.You can see this link Hide elements during loading using
v-cloak
for better understating.