feat: add pwa

This commit is contained in:
camera-2018
2024-02-13 18:33:33 +08:00
parent 3bac8037ab
commit 31b90889d5
6 changed files with 4290 additions and 1 deletions

View File

@@ -32,6 +32,8 @@ export default {
if (typeof window !== 'undefined') {
// detect browser, add to class for conditional styling
import('./pwa.js')
const browser = navigator.userAgent.toLowerCase()
if (browser.includes('chrome'))
document.documentElement.classList.add('browser-chrome')

3
.vitepress/theme/pwa.js Normal file
View File

@@ -0,0 +1,3 @@
import { registerSW } from 'virtual:pwa-register'
registerSW({ immediate: true })