表达式闪现问题

1、案例1

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>表达式闪现问题</title>
    <style>
        /* 
        Vue在解释表达式前可能会在界面上闪现一下表达式,
        表达式解释前会在元素上加v-cloak属性,所以加如下
        属性样式可解决表达式闪现问题
        */
        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>
    <div id="app">
        <p>{{date}}</p>
    </div>
    <script src="../js/vue.js" type="text/javascript"></script>
    <script>
        alert(100)
        const vm = new Vue({
            el: "#app",
            data: {
                date: new Date()
            }
        });
    </script>
</body>

</html>
原文地址:https://www.cnblogs.com/liuyang-520/p/12491708.html