chore: pwa update prompt

This commit is contained in:
鲁树人
2023-10-11 23:06:09 +01:00
parent 1566c0ffcb
commit 022c9d1eac
3 changed files with 20 additions and 1 deletions

10
src/pwa.ts Normal file
View File

@@ -0,0 +1,10 @@
import { registerSW } from 'virtual:pwa-register';
const updateSW = registerSW({
onNeedRefresh() {
if (confirm('应用程序已更新,是否刷新?')) {
updateSW();
}
},
onOfflineReady() {},
});