S
S
sitev_ru2017-07-29 17:14:13
JavaScript
sitev_ru, 2017-07-29 17:14:13

How can I make it immediately display "Hello Vue!"?

I saw an article on Habré https://habrahabr.ru/post/333004/ about Vue. Decided to try an example:

<div id="app">{{ message }}</div>

<script src="https://unpkg.com/vue"></script>
<script>
  new Vue({
    el: '#app',
    data: {
      message: 'Hello Vue!'
    }
  })
</script>

The following immediately annoys me: the inscription {{ message }} appears, which lasts for a whole second! Then the inscription changes to "Hello Vue!"
How can I make it immediately display "Hello Vue!"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Koch, 2017-07-29
@sitev_ru

Your library takes a long time to load, so it hangs when the library is loaded quickly, or from the cache, this will not be noticeable. To hide this effect use v-cloak .
Example with timeouts: https://jsfiddle.net/whata/50wL7mdz/50159/
Ps Include Vue in the head block on the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question