fix(VersionUpdateToast): 优化通知样式

fix(useVersionChecker): 优化处理逻辑
This commit is contained in:
PKC278
2026-01-03 20:15:05 +08:00
parent 43d2406ee9
commit 0fcad02f3b
5 changed files with 55 additions and 14 deletions

View File

@@ -1,9 +1,10 @@
<template>
<div class="version-update-toast">
<span class="message">{{ message }}</span>
<button class="refresh-button" @click="handleRefresh">
<button v-if="refreshText" class="refresh-button" @click="handleRefresh">
{{ refreshText }}
</button>
<div v-else class="spinner"></div>
</div>
</template>
@@ -11,7 +12,7 @@
// 接收 props
interface Props {
message: string
refreshText: string
refreshText?: string
onRefresh?: () => void
}
@@ -30,12 +31,12 @@ const handleRefresh = () => {
.version-update-toast {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.message {
flex: 1;
white-space: nowrap;
}
.refresh-button {
@@ -48,6 +49,7 @@ const handleRefresh = () => {
font-size: 14px;
font-weight: 500;
white-space: nowrap;
flex-shrink: 0;
transition: all 0.2s;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
@@ -60,4 +62,20 @@ const handleRefresh = () => {
.refresh-button:active {
transform: scale(0.98);
}
.spinner {
width: 16px;
height: 16px;
border: 2px solid rgba(255, 255, 255, 0.3);
border-top-color: #fff;
border-radius: 50%;
animation: spin 0.8s linear infinite;
flex-shrink: 0;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
</style>