mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 12:32:17 +08:00
chore: fix sw.js error (#7667)
This commit is contained in:
@ -67,6 +67,20 @@ export const head: HeadConfig[] = [
|
|||||||
src: 'https://www.googletagmanager.com/gtag/js?id=UA-175337989-1',
|
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',
|
'script',
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,6 @@ import VPSubNav from './vp-subnav.vue'
|
|||||||
import VPSidebar from './vp-sidebar.vue'
|
import VPSidebar from './vp-sidebar.vue'
|
||||||
import VPContent from './vp-content.vue'
|
import VPContent from './vp-content.vue'
|
||||||
import VPSponsors from './vp-sponsors.vue'
|
import VPSponsors from './vp-sponsors.vue'
|
||||||
import VPReloadPrompt from './vp-reload-prompt.vue'
|
|
||||||
|
|
||||||
const USER_PREFER_GITHUB_PAGE = 'USER_PREFER_GITHUB_PAGE'
|
const USER_PREFER_GITHUB_PAGE = 'USER_PREFER_GITHUB_PAGE'
|
||||||
const [isSidebarOpen, toggleSidebar] = useToggle(false)
|
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()
|
Reference in New Issue
Block a user