I am trying to learn vue and created the sample below purely for test purposes:
import App from '../p/app.vue';
import Two from '../p/two.vue';
const routes = [
{ path: '/', ponent: App },
{ path: '/two', ponent: Two }
]
const router = new VueRouter({
base: base.pathname,
mode: "history",
routes // short for routes: routes
})
window.app = new Vue({
el: "#container",
data: {
message: "home",
date: new Date(),
seen: false,
fruits: [
{ name: "apple" },
{ name: "orange" },
{ name: "banana" }
]
}
})
But, before inserting any values the page will display the mustache syntax for a brief moment. Almost as if VueJS isn't working. After a short while VueJS will kick in and fill in the right values for the variables.
Why is that happening and how can I fix this behavior?
I am trying to learn vue and created the sample below purely for test purposes:
import App from '../p/app.vue';
import Two from '../p/two.vue';
const routes = [
{ path: '/', ponent: App },
{ path: '/two', ponent: Two }
]
const router = new VueRouter({
base: base.pathname,
mode: "history",
routes // short for routes: routes
})
window.app = new Vue({
el: "#container",
data: {
message: "home",
date: new Date(),
seen: false,
fruits: [
{ name: "apple" },
{ name: "orange" },
{ name: "banana" }
]
}
})
But, before inserting any values the page will display the mustache syntax for a brief moment. Almost as if VueJS isn't working. After a short while VueJS will kick in and fill in the right values for the variables.
Why is that happening and how can I fix this behavior?
Share Improve this question edited Jan 31, 2017 at 22:06 Rick van Lieshout 2,3162 gold badges24 silver badges41 bronze badges asked Jan 31, 2017 at 21:34 fozusefozuse 7842 gold badges12 silver badges30 bronze badges1 Answer
Reset to default 10It's because vueJS hasn't loaded up all the way yet.
you can use a so called "v-cloak" to hide it. To do so add this to your css:
[v-cloak] {
display: none;
}
And decorate your element with the v-cloak tag like so:
<div v-cloak>
{{ message }}
</div>
More info can be found at: https://v2.vuejs/v2/api/#v-cloak