feat(pwa): 重构 Service Worker 及版本更新机制

This commit is contained in:
PKC278
2026-01-02 20:36:33 +08:00
parent 2281e4224b
commit 6d2916dc9f
10 changed files with 431 additions and 543 deletions
+3 -5
View File
@@ -1,12 +1,10 @@
<script lang="ts" setup>
import { formatDateDifference } from '@/@core/utils/formatters'
import api from '@/api'
import { clearCachesAndServiceWorker } from '@/composables/useVersionChecker'
import { clearCachesAndServiceWorker, reloadWithTimestamp } from '@/composables/useVersionChecker'
import { useI18n } from 'vue-i18n'
import { useDisplay } from 'vuetify'
declare const __APP_VERSION__: string
// 国际化
const { t } = useI18n()
@@ -124,8 +122,8 @@ function releaseTime(releaseDate: string) {
// 强制清除缓存
async function cleanCache() {
await clearCachesAndServiceWorker()
// 刷新页面
window.location.reload()
// 刷新页面,添加时间戳参数以强制更新
reloadWithTimestamp()
}
onMounted(() => {