Jiarenxiang | 5f4247d | 2025-06-06 18:10:35 +0800 | [diff] [blame] | 1 | /** |
| 2 | * loading 占位 |
| 3 | * 解决首次加载时白屏的问题 |
| 4 | */ |
| 5 | (function () { |
| 6 | const _root = document.querySelector('#root'); |
| 7 | if (_root && _root.innerHTML === '') { |
| 8 | _root.innerHTML = ` |
| 9 | <style> |
| 10 | html, |
| 11 | body, |
| 12 | #root { |
| 13 | height: 100%; |
| 14 | margin: 0; |
| 15 | padding: 0; |
| 16 | } |
| 17 | #root { |
| 18 | background-repeat: no-repeat; |
| 19 | background-size: 100% auto; |
| 20 | } |
| 21 | |
| 22 | .loading-title { |
| 23 | font-size: 1.1rem; |
| 24 | } |
| 25 | |
| 26 | .loading-sub-title { |
| 27 | margin-top: 20px; |
| 28 | font-size: 1rem; |
| 29 | color: #888; |
| 30 | } |
| 31 | |
| 32 | .page-loading-warp { |
| 33 | display: flex; |
| 34 | align-items: center; |
| 35 | justify-content: center; |
| 36 | padding: 26px; |
| 37 | } |
| 38 | .ant-spin { |
| 39 | position: absolute; |
| 40 | display: none; |
| 41 | -webkit-box-sizing: border-box; |
| 42 | box-sizing: border-box; |
| 43 | margin: 0; |
| 44 | padding: 0; |
| 45 | color: rgba(0, 0, 0, 0.65); |
| 46 | color: #1890ff; |
| 47 | font-size: 14px; |
| 48 | font-variant: tabular-nums; |
| 49 | line-height: 1.5; |
| 50 | text-align: center; |
| 51 | list-style: none; |
| 52 | opacity: 0; |
| 53 | -webkit-transition: -webkit-transform 0.3s |
| 54 | cubic-bezier(0.78, 0.14, 0.15, 0.86); |
| 55 | transition: -webkit-transform 0.3s |
| 56 | cubic-bezier(0.78, 0.14, 0.15, 0.86); |
| 57 | transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); |
| 58 | transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86), |
| 59 | -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); |
| 60 | -webkit-font-feature-settings: "tnum"; |
| 61 | font-feature-settings: "tnum"; |
| 62 | } |
| 63 | |
| 64 | .ant-spin-spinning { |
| 65 | position: static; |
| 66 | display: inline-block; |
| 67 | opacity: 1; |
| 68 | } |
| 69 | |
| 70 | .ant-spin-dot { |
| 71 | position: relative; |
| 72 | display: inline-block; |
| 73 | width: 20px; |
| 74 | height: 20px; |
| 75 | font-size: 20px; |
| 76 | } |
| 77 | |
| 78 | .ant-spin-dot-item { |
| 79 | position: absolute; |
| 80 | display: block; |
| 81 | width: 9px; |
| 82 | height: 9px; |
| 83 | background-color: #1890ff; |
| 84 | border-radius: 100%; |
| 85 | -webkit-transform: scale(0.75); |
| 86 | -ms-transform: scale(0.75); |
| 87 | transform: scale(0.75); |
| 88 | -webkit-transform-origin: 50% 50%; |
| 89 | -ms-transform-origin: 50% 50%; |
| 90 | transform-origin: 50% 50%; |
| 91 | opacity: 0.3; |
| 92 | -webkit-animation: antspinmove 1s infinite linear alternate; |
| 93 | animation: antSpinMove 1s infinite linear alternate; |
| 94 | } |
| 95 | |
| 96 | .ant-spin-dot-item:nth-child(1) { |
| 97 | top: 0; |
| 98 | left: 0; |
| 99 | } |
| 100 | |
| 101 | .ant-spin-dot-item:nth-child(2) { |
| 102 | top: 0; |
| 103 | right: 0; |
| 104 | -webkit-animation-delay: 0.4s; |
| 105 | animation-delay: 0.4s; |
| 106 | } |
| 107 | |
| 108 | .ant-spin-dot-item:nth-child(3) { |
| 109 | right: 0; |
| 110 | bottom: 0; |
| 111 | -webkit-animation-delay: 0.8s; |
| 112 | animation-delay: 0.8s; |
| 113 | } |
| 114 | |
| 115 | .ant-spin-dot-item:nth-child(4) { |
| 116 | bottom: 0; |
| 117 | left: 0; |
| 118 | -webkit-animation-delay: 1.2s; |
| 119 | animation-delay: 1.2s; |
| 120 | } |
| 121 | |
| 122 | .ant-spin-dot-spin { |
| 123 | -webkit-transform: rotate(45deg); |
| 124 | -ms-transform: rotate(45deg); |
| 125 | transform: rotate(45deg); |
| 126 | -webkit-animation: antrotate 1.2s infinite linear; |
| 127 | animation: antRotate 1.2s infinite linear; |
| 128 | } |
| 129 | |
| 130 | .ant-spin-lg .ant-spin-dot { |
| 131 | width: 32px; |
| 132 | height: 32px; |
| 133 | font-size: 32px; |
| 134 | } |
| 135 | |
| 136 | .ant-spin-lg .ant-spin-dot i { |
| 137 | width: 14px; |
| 138 | height: 14px; |
| 139 | } |
| 140 | |
| 141 | @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { |
| 142 | .ant-spin-blur { |
| 143 | background: #fff; |
| 144 | opacity: 0.5; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | @-webkit-keyframes antSpinMove { |
| 149 | to { |
| 150 | opacity: 1; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | @keyframes antSpinMove { |
| 155 | to { |
| 156 | opacity: 1; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | @-webkit-keyframes antRotate { |
| 161 | to { |
| 162 | -webkit-transform: rotate(405deg); |
| 163 | transform: rotate(405deg); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | @keyframes antRotate { |
| 168 | to { |
| 169 | -webkit-transform: rotate(405deg); |
| 170 | transform: rotate(405deg); |
| 171 | } |
| 172 | } |
| 173 | </style> |
| 174 | |
| 175 | <div style=" |
| 176 | display: flex; |
| 177 | flex-direction: column; |
| 178 | align-items: center; |
| 179 | justify-content: center; |
| 180 | height: 100%; |
| 181 | min-height: 362px; |
| 182 | "> |
| 183 | <div class="page-loading-warp"> |
| 184 | <div class="ant-spin ant-spin-lg ant-spin-spinning"> |
| 185 | <span class="ant-spin-dot ant-spin-dot-spin"> |
| 186 | <i class="ant-spin-dot-item"></i> |
| 187 | <i class="ant-spin-dot-item"></i> |
| 188 | <i class="ant-spin-dot-item"></i> |
| 189 | <i class="ant-spin-dot-item"></i> |
| 190 | </span> |
| 191 | </div> |
| 192 | </div> |
| 193 | <div class="loading-title"> |
| 194 | 正在加载资源 |
| 195 | </div> |
| 196 | <div class="loading-sub-title"> |
| 197 | 初次加载资源可能需要较多时间 请耐心等待 |
| 198 | </div> |
| 199 | </div> |
| 200 | `; |
| 201 | } |
| 202 | })(); |