2017-08-26 63 views
0

我有一个在我的应用程序的侧栏上使用Vue.js构建的头像小部件。加载需要一秒的时间,这会导致侧边栏打开。有没有一种方法可以在加载时显示纯HTML代替Vue应用程序?基本上与v-cloak相反。在Vue.js加载之前显示纯HTML HTML文件

回答

0

您可以使用beforeCreate yada beforeMount手动显示html。

new Vue({ 
    el: '#editor', 
    data: { 
    input: '# hello' 
    }, 
    beforeCreate: function() { 
    this.a = "First Value"; 
    console.log("First Value"); 
    }, 
    created: function() { 
    this.a = "Second Value"; 
    console.log("Second Value"); 
    }, 
    beforeMount: function() { 
    this.a = "Third Value"; 
    console.log("Third Value"); 
    } 
}) 

https://vuejs.org/v2/guide/instance.html