vue.js 未加载页面时会闪 {{}}(花括号)

2019-01-14 10:46:00 阅读:5 编辑
可能只有在网络慢时会出现,就因为 HTML 先加载,再加载 JS
<!doctype HTML>
<HTML lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Document</title>
    <style>
        p.active {color: red;}
        p.title {font-weight: 700;}
        [v-cloak]{display: none !important;}
    </style>
</head>
<body>
<div id="App" v-cloak>
    <p v-bind:class="{active:is_active}" class="title">
        {{msg}}
    </p>
</div>

</body>
<script src="/vendor/images/vue.js"></script>
<script>
    new Vue ({
        el: '#App',
        data: {
            msg: "hello",
            is_active: true,
        },
    });
</script>
</HTML>