Vue3+Ts+Vite project (Part 11) - Project startup loading loading effect

Introduction

Achieve the loading effect when loading the same project of vue-pure-admin in one minute

1. Look at the effect first

1.1 Static effect

Insert image description here

1.2 Dynamic effects

Please add image description

2. Upload the code

The core code is in the body and is marked in the code. Find the index.html of your project and 复制粘贴go in

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
    />
    <title>vue-pure-admin</title>
    <link rel="icon" href="/favicon.ico" />
    <script>
      window.process = {
    
    };
    </script>
  </head>

  <body>
    // 核心代码-开始
    <div id="app">
      <style>
        html,
        body,
        #app {
    
    
          width: 100%;
          height: 100%;
          display: flex;
          position: relative;
          justify-content: center;
          align-items: center;
          overflow: hidden;
        }

        .loader,
        .loader:before,
        .loader:after {
    
    
          border-radius: 50%;
          width: 2.5em;
          height: 2.5em;
          animation-fill-mode: both;
          animation: loadAnimation 1.8s infinite ease-in-out;
        }

        .loader {
    
    
          color: #406eeb;
          font-size: 10px;
          margin: 80px auto;
          position: relative;
          text-indent: -9999em;
          transform: translateZ(0);
          animation-delay: -0.16s;
          top: 0;
          transform: translate(-50%, 0);
        }

        .loader:before,
        .loader:after {
    
    
          content: "";
          position: absolute;
          top: 0;
        }

        .loader:before {
    
    
          left: -3.5em;
          animation-delay: -0.32s;
        }

        .loader:after {
    
    
          left: 3.5em;
        }

        @keyframes loadAnimation {
    
    
          0%,
          80%,
          100% {
    
    
            box-shadow: 0 2.5em 0 -1.3em;
          }

          40% {
    
    
            box-shadow: 0 2.5em 0 0;
          }
        }
      </style>
      <div class="loader"></div>
    </div>
    // 核心代码-结束
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>

Guess you like

Origin blog.csdn.net/qq_61402485/article/details/132416025