张延森 преди 3 години
родител
ревизия
1dc9ffc9eb
променени са 2 файла, в които са добавени 17 реда и са изтрити 4 реда
  1. 16
    3
      public/index.html
  2. 1
    1
      src/utils/index.js

+ 16
- 3
public/index.html Целия файл

@@ -7,16 +7,27 @@
7 7
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8 8
     <title><%= htmlWebpackPlugin.options.title %></title>
9 9
     <style>
10
-      .mainloading {
10
+      .page-loading-wrapper {
11 11
         position: absolute;
12 12
         left: 0;
13 13
         top: 0;
14 14
         width: 100vw;
15 15
         height: 100vh;
16 16
         overflow: hidden;
17
+        z-index: 999;
18
+      }
17 19
 
20
+      .page-loading {
21
+        width: 100%;
22
+        height: 100%;
18 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 32
     </style>
22 33
   </head>
@@ -24,7 +35,9 @@
24 35
     <noscript>
25 36
       <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
26 37
     </noscript>
27
-    <div class="mainloading"></div>
38
+    <div class="page-loading-wrapper">
39
+      <div class="page-loading"></div> 
40
+    </div>
28 41
     <div id="app"></div>
29 42
     <!-- built files will be auto injected -->
30 43
   </body>

+ 1
- 1
src/utils/index.js Целия файл

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