mirror of
https://github.com/KoriIku/luxirty-search
synced 2024-11-23 10:05:17 +00:00
尝试移除 service worker
This commit is contained in:
parent
0b8c3a34f7
commit
08185fbfb1
34
src/main.js
34
src/main.js
@ -8,19 +8,21 @@ const app = createApp(App)
|
||||
|
||||
app.use(router)
|
||||
|
||||
// 注册 Service Worker
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/service-worker.js').then((registration) => {
|
||||
console.log('Service Worker 注册成功,作用域为: ', registration.scope);
|
||||
return registration.update(); // 立即更新 Service Worker
|
||||
}).then(() => {
|
||||
app.mount('#app'); // 确保在 Service Worker 注册后再挂载 Vue 实例
|
||||
}).catch((err) => {
|
||||
console.error('Service Worker 注册失败: ', err);
|
||||
app.mount('#app'); // 即使注册失败,也要确保 Vue 挂载
|
||||
});
|
||||
});
|
||||
} else {
|
||||
app.mount('#app'); // 如果浏览器不支持 Service Worker,继续正常挂载
|
||||
}
|
||||
app.mount('#app');
|
||||
|
||||
// // 注册 Service Worker
|
||||
// if ('serviceWorker' in navigator) {
|
||||
// window.addEventListener('load', () => {
|
||||
// navigator.serviceWorker.register('/service-worker.js').then((registration) => {
|
||||
// console.log('Service Worker 注册成功,作用域为: ', registration.scope);
|
||||
// return registration.update(); // 立即更新 Service Worker
|
||||
// }).then(() => {
|
||||
// app.mount('#app'); // 确保在 Service Worker 注册后再挂载 Vue 实例
|
||||
// }).catch((err) => {
|
||||
// console.error('Service Worker 注册失败: ', err);
|
||||
// app.mount('#app'); // 即使注册失败,也要确保 Vue 挂载
|
||||
// });
|
||||
// });
|
||||
// } else {
|
||||
// app.mount('#app'); // 如果浏览器不支持 Service Worker,继续正常挂载
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user