feat: 添加 PWA 支持
This commit is contained in:
@@ -83,4 +83,14 @@ app.use(i18n); // 使用 i18n
|
||||
}
|
||||
app.mount('#app');
|
||||
}
|
||||
// --- PWA Service Worker Registration ---
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js').then(registration => {
|
||||
console.log('SW registered: ', registration);
|
||||
}).catch(registrationError => {
|
||||
console.log('SW registration failed: ', registrationError);
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user