mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 02:08:12 +08:00
chore: fix sw.js error (#7667)
This commit is contained in:
parent
591a7c32f3
commit
ae25f4e14a
@ -67,6 +67,20 @@ export const head: HeadConfig[] = [
|
||||
src: 'https://www.googletagmanager.com/gtag/js?id=UA-175337989-1',
|
||||
},
|
||||
],
|
||||
[
|
||||
'script',
|
||||
{},
|
||||
`if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register('/sw.js')
|
||||
.then(function(registration) {
|
||||
console.log(registration);
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
}`,
|
||||
],
|
||||
[
|
||||
'script',
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ import VPSubNav from './vp-subnav.vue'
|
||||
import VPSidebar from './vp-sidebar.vue'
|
||||
import VPContent from './vp-content.vue'
|
||||
import VPSponsors from './vp-sponsors.vue'
|
||||
import VPReloadPrompt from './vp-reload-prompt.vue'
|
||||
|
||||
const USER_PREFER_GITHUB_PAGE = 'USER_PREFER_GITHUB_PAGE'
|
||||
const [isSidebarOpen, toggleSidebar] = useToggle(false)
|
||||
|
12
docs/public/sw.js
Normal file
12
docs/public/sw.js
Normal file
@ -0,0 +1,12 @@
|
||||
self.addEventListener('activate', (e) => {
|
||||
e.waitUntil(
|
||||
caches.keys().then((t) => {
|
||||
return Promise.all(
|
||||
t.map((n) => {
|
||||
return caches.delete(n)
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
self.skipWaiting()
|
Loading…
Reference in New Issue
Block a user