Skip to content

Commit

Permalink
feat: 修改浏览器显示的标题,增加加载动画
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikasa33 committed Jul 13, 2023
1 parent 76152af commit 2244a7a
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 51 deletions.
140 changes: 137 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,146 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
<title><%= title %></title>
</head>
<body>
<div id="app"></div>
<div id="app">
<style>
body {
margin: 0;
font-size: 14px;
font-family: v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
line-height: 1.6;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}

.app-loading {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
flex-direction: column;
background-color: #f4f7f9;
}

.app-loading .app-loading-wrap {
position: absolute;
top: 50%;
left: 50%;
display: flex;
transform: translate3d(-50%, -50%, 0);
justify-content: center;
align-items: center;
flex-direction: column;
}

.app-loading .dots {
display: flex;
padding: 98px;
justify-content: center;
align-items: center;
}

.app-loading .app-loading-title {
display: flex;
margin-top: 30px;
font-size: 30px;
color: rgb(0 0 0 / 85%);
justify-content: center;
align-items: center;
}

.app-loading .app-loading-logo {
display: block;
width: 90px;
margin: 0 auto;
margin-bottom: 20px;
}

.dot {
position: relative;
display: inline-block;
width: 46px;
height: 46px;
margin-top: 20px;
font-size: 32px;
transform: rotate(45deg);
box-sizing: border-box;
animation: antRotate 1.2s infinite linear;
}

.dot i {
position: absolute;
display: block;
width: 20px;
height: 20px;
background-color: #18a058;
border-radius: 100%;
opacity: 30%;
transform: scale(0.75);
animation: antSpinMove 1s infinite linear alternate;
transform-origin: 50% 50%;
}

.dot i:nth-child(1) {
top: 0;
left: 0;
}

.dot i:nth-child(2) {
top: 0;
right: 0;
animation-delay: 0.4s;
}

.dot i:nth-child(3) {
right: 0;
bottom: 0;
animation-delay: 0.8s;
}

.dot i:nth-child(4) {
bottom: 0;
left: 0;
animation-delay: 1.2s;
}
@keyframes antRotate {
to {
transform: rotate(405deg);
}
}
@keyframes antRotate {
to {
transform: rotate(405deg);
}
}
@keyframes antSpinMove {
to {
opacity: 100%;
}
}
@keyframes antSpinMove {
to {
opacity: 100%;
}
}
</style>
<div class="app-loading">
<div class="app-loading-wrap">
<img src="/logo.png" class="app-loading-logo" alt="Logo" />
<div class="app-loading-dots">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
<div class="app-loading-title"><%= title %></div>
</div>
</div>
</div>

<script type="module" src="/src/main.ts"></script>

<!-- 使用 CDN 加载图标 -->
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"unplugin-auto-import": "^0.16.4",
"unplugin-vue-components": "^0.25.1",
"vite": "^4.3.9",
"vite-plugin-html": "^3.2.0",
"vue-tsc": "^1.6.5"
}
}
Loading

0 comments on commit 2244a7a

Please sign in to comment.