Merge branch 'runny&xinxin' into dev
This commit is contained in:
commit
8d73343bd8
77 files changed
+17955
-274
No files matched your search
+13
-6
@@ -1,4 +1,4 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
@@ -52,10 +52,17 @@ createApp(App)
|
||||
.use(i18n)
|
||||
.mount('#app')
|
||||
|
||||
if (import.meta.env.PROD && 'serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js').catch((err) => {
|
||||
console.error('Service worker registration failed:', err);
|
||||
});
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', async () => {
|
||||
try {
|
||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||
await Promise.all(registrations.map((registration) => registration.unregister()));
|
||||
if ('caches' in window) {
|
||||
const cacheKeys = await window.caches.keys();
|
||||
await Promise.all(cacheKeys.map((key) => window.caches.delete(key)));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Service worker cleanup failed:', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user