elementUI vue 頁面加載的時候頁面出現了黑字 頁面優化處理 按鈕彈出框文字

elementUI 頁面若是須要加載不少東西的時候, 本身定義的按鈕或者彈出框dialog的文字就會顯示在頁面上, 一閃而過, 所以須要優化一下, elementUI 提供的loading有遮罩層, 具體使用就不說了, 下面提供的是普通的處理方法,簡單實用!!css

 

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <style media="screen" type="text/css">
        #appLoading { width: 100%; height: 100%; }
        #appLoading span {
            position: absolute;
            display: block;
            font-size: 50px;
            line-height: 50px;
            top: 50%;
            left: 50%;
            width: 200px;
            height: 100px;
            -webkit-transform: translateY(-50%)  translateX(-50%);
            transform: translateY(-50%)  translateX(-50%);
        }
    </style>
</head>
<body>
<div id="appLoading">
    <span>Loading...</span>
</div>
<div id="app" style="display: none">
    <app>123</app>
</div>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

<script>
    new Vue({
        el: '#app',
        data: function () {
        },

        //加載完成時調用
        created: function () {

        },
        //頁面加載成功時完成
        mounted(){
            document.getElementById('app').style.display = 'block';
            document.getElementById('appLoading').style.display = 'none';
        },
        //方法
        methods: {
        },


    })
</script>
</body>
</html>
相關文章
相關標籤/搜索