Commit 4f98978edacbe72610a226267628ab20b57cfc4e

Authored by vben
1 parent 275ad9f1

feat: global loading add text

CHANGELOG.zh_CN.md
1 ## Wip 1 ## Wip
2 2
  3 +### ✨ Features
  4 +
  5 +- 全局 loading 添加文本
  6 +
3 ### ⚡ Performance Improvements 7 ### ⚡ Performance Improvements
4 8
5 - Layout 界面布局样式调整 9 - Layout 界面布局样式调整
build/vite/plugin/index.ts
@@ -37,6 +37,7 @@ export function createVitePlugins(viteEnv: ViteEnv) { @@ -37,6 +37,7 @@ export function createVitePlugins(viteEnv: ViteEnv) {
37 : '', 37 : '',
38 // Insert Baidu statistics code 38 // Insert Baidu statistics code
39 hmScript: isSiteMode() ? hmScript : '', 39 hmScript: isSiteMode() ? hmScript : '',
  40 + title: VITE_GLOB_APP_TITLE,
40 }, 41 },
41 }) 42 })
42 ); 43 );
index.html
@@ -9,79 +9,71 @@ @@ -9,79 +9,71 @@
9 name="viewport" 9 name="viewport"
10 content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" 10 content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
11 /> 11 />
  12 +
12 <title></title> 13 <title></title>
13 <link rel="icon" href="/favicon.ico" /> 14 <link rel="icon" href="/favicon.ico" />
14 <%= viteHtmlPluginOptions.injectConfig %> 15 <%= viteHtmlPluginOptions.injectConfig %>
15 - </head>  
16 - <body>  
17 - <div id="app">  
18 - <style>  
19 - @keyframes load {  
20 - 0% {  
21 - -webkit-transform: rotate(-360deg);  
22 - -moz-transform: rotate(-360deg);  
23 - -ms-transform: rotate(-360deg);  
24 - -o-transform: rotate(-360deg);  
25 - transform: rotate(-360deg);  
26 - }  
27 16
28 - 100% {  
29 - -webkit-transform: rotate(0);  
30 - -moz-transform: rotate(0);  
31 - -ms-transform: rotate(0);  
32 - -o-transform: rotate(0);  
33 - transform: rotate(0);  
34 - } 17 + <style>
  18 + @keyframes load {
  19 + 0% {
  20 + -webkit-transform: rotate(-360deg);
  21 + transform: rotate(-360deg);
35 } 22 }
36 23
37 - .g-loading {  
38 - -webkit-animation: load 2s linear infinite;  
39 - -moz-animation: load 2s linear infinite;  
40 - -ms-animation: load 2s linear infinite;  
41 - -o-animation: load 2s linear infinite;  
42 - animation: load 2s linear infinite;  
43 - -webkit-transform-origin: center center;  
44 - -moz-transform-origin: center center;  
45 - -ms-transform-origin: center center;  
46 - -o-transform-origin: center center;  
47 - transform-origin: center center; 24 + 100% {
  25 + -webkit-transform: rotate(0);
  26 + transform: rotate(0);
48 } 27 }
  28 + }
49 29
50 - .app-loading {  
51 - width: 100%;  
52 - height: 100%;  
53 - background: rgba(255, 255, 255, 0, 1);  
54 - } 30 + .app-loading {
  31 + width: 100%;
  32 + height: 100%;
55 33
56 - .app-loading .app-loading-wrap {  
57 - position: absolute;  
58 - top: 45%;  
59 - left: 50%;  
60 - width: 64px;  
61 - -ms-transform: translate3d(-50%, -50%, 0);  
62 - -moz-transform: translate3d(-50%, -50%, 0);  
63 - -webkit-transform: translate3d(-50%, -50%, 0);  
64 - -o-transform: translate3d(-50%, -50%, 0);  
65 - transform: translate3d(-50%, -50%, 0);  
66 - } 34 + /* background: #f0f2f5; */
  35 + }
67 36
68 - .app-loading .app-loading-wrap img.logo {  
69 - margin-bottom: 20px;  
70 - margin-left: -20px;  
71 - } 37 + .app-loading .app-loading-wrap {
  38 + position: absolute;
  39 + top: 50%;
  40 + left: 50%;
  41 + -webkit-transform: translate3d(-50%, -50%, 0);
  42 + transform: translate3d(-50%, -50%, 0);
  43 + }
72 44
73 - .app-loading .app-loading-wrap .app-loading__tip {  
74 - display: block;  
75 - margin-top: 4px;  
76 - font-size: 13px;  
77 - color: #303133;  
78 - text-align: center;  
79 - }  
80 - </style> 45 + .app-loading .g-loading {
  46 + display: block;
  47 + width: 64px;
  48 + margin: 30px auto;
  49 + -webkit-animation: load 1.2s linear infinite;
  50 + animation: load 1.2s linear infinite;
  51 + -webkit-transform-origin: center center;
  52 + transform-origin: center center;
  53 + }
  54 +
  55 + .app-loading .app-loading-wrap img.logo {
  56 + display: block;
  57 + width: 90px;
  58 + margin: 0 auto;
  59 + margin-bottom: 20px;
  60 + }
  61 +
  62 + .app-loading .app-loading-wrap .app-loading__tip {
  63 + display: block;
  64 + margin: 20px auto 0 0;
  65 + font-size: 30px;
  66 + color: #2c3a61;
  67 + }
  68 + </style>
  69 + </head>
  70 + <body>
  71 + <div id="app">
81 <section class="app-loading"> 72 <section class="app-loading">
82 <section class="app-loading-wrap"> 73 <section class="app-loading-wrap">
83 <img src="./resource/img/logo.png" class="logo" alt="Logo" /> 74 <img src="./resource/img/logo.png" class="logo" alt="Logo" />
84 <img src="./resource/img/loading.svg" alt="" class="g-loading" /> 75 <img src="./resource/img/loading.svg" alt="" class="g-loading" />
  76 + <h1 class="app-loading__tip"><%= viteHtmlPluginOptions.title %></h1>
85 </section> 77 </section>
86 </section> 78 </section>
87 </div> 79 </div>
public/resource/img/loading.svg
@@ -18,21 +18,6 @@ @@ -18,21 +18,6 @@
18 .bottom { 18 .bottom {
19 fill: #9dbfe4; 19 fill: #9dbfe4;
20 } 20 }
21 - @keyframes load {  
22 - 0% {  
23 - transform: rotate(-360deg);  
24 - }  
25 -  
26 - 100% {  
27 - transform: rotate(0);  
28 - }  
29 - }  
30 -  
31 - .load {  
32 - animation: load 1.4s linear infinite;  
33 - transform-origin: center center;  
34 - }  
35 -  
36 svg { 21 svg {
37 display: block; 22 display: block;
38 } 23 }
@@ -42,7 +27,7 @@ @@ -42,7 +27,7 @@
42 min-width: 100px; 27 min-width: 100px;
43 margin-top: 4px; 28 margin-top: 4px;
44 font-size: 13px; 29 font-size: 13px;
45 - color: #303133; 30 + color: #2C3A61;
46 text-align: left; 31 text-align: left;
47 } 32 }
48 </style> 33 </style>