张延森 3 years ago
parent
commit
1dc9ffc9eb
2 changed files with 17 additions and 4 deletions
  1. 16
    3
      public/index.html
  2. 1
    1
      src/utils/index.js

+ 16
- 3
public/index.html View File

7
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
7
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
     <title><%= htmlWebpackPlugin.options.title %></title>
8
     <title><%= htmlWebpackPlugin.options.title %></title>
9
     <style>
9
     <style>
10
-      .mainloading {
10
+      .page-loading-wrapper {
11
         position: absolute;
11
         position: absolute;
12
         left: 0;
12
         left: 0;
13
         top: 0;
13
         top: 0;
14
         width: 100vw;
14
         width: 100vw;
15
         height: 100vh;
15
         height: 100vh;
16
         overflow: hidden;
16
         overflow: hidden;
17
+        z-index: 999;
18
+      }
17
 
19
 
20
+      .page-loading {
21
+        width: 100%;
22
+        height: 100%;
18
         background: #262626 url('./loading.gif') no-repeat center center;
23
         background: #262626 url('./loading.gif') no-repeat center center;
19
-        z-index: 999;
24
+        animation: loadingrotate 2s linear infinite;
25
+      }
26
+
27
+      @keyframes loadingrotate {
28
+        100% {
29
+          transform:rotate(360deg);
30
+        }
20
       }
31
       }
21
     </style>
32
     </style>
22
   </head>
33
   </head>
24
     <noscript>
35
     <noscript>
25
       <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
36
       <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
26
     </noscript>
37
     </noscript>
27
-    <div class="mainloading"></div>
38
+    <div class="page-loading-wrapper">
39
+      <div class="page-loading"></div> 
40
+    </div>
28
     <div id="app"></div>
41
     <div id="app"></div>
29
     <!-- built files will be auto injected -->
42
     <!-- built files will be auto injected -->
30
   </body>
43
   </body>

+ 1
- 1
src/utils/index.js View File

1
 
1
 
2
 export function hideLoading() {
2
 export function hideLoading() {
3
-  document.getElementsByClassName('mainloading')[0].style="display: none"
3
+  document.getElementsByClassName('page-loading-wrapper')[0].style="display: none"
4
 }
4
 }