1 Star 0 Fork 0

kecanwen/changshu_adminPro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
registerServiceWorker.js 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
kecanwen 提交于 2023-05-29 21:56 . 合并代码
/* eslint-disable no-console */
import { register } from 'register-service-worker'
import Vue from 'vue'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
},
registered() {
console.log('Service worker has been registered.')
},
cached() {
console.log('Content has been cached for offline use.')
},
updatefound() {
console.log('New content is downloading.')
Vue.prototype.$baseNotify(
'检测到新版本,正在下载中,请稍后...',
'温馨提示',
'success',
'bottom-right',
8000
)
},
updated() {
console.log('New content is available; please refresh.')
Vue.prototype.$baseNotify(
'更新版本完成,10S后刷新项目',
'温馨提示',
'success',
'bottom-right',
8000
)
setTimeout(() => {
window.location.reload()
}, 10000)
},
offline() {
console.log(
'No internet connection found. App is running in offline mode.'
)
},
error(error) {
console.error('Error during service worker registration:', error)
},
})
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kecanwen/changshu_admin-pro.git
git@gitee.com:kecanwen/changshu_admin-pro.git
kecanwen
changshu_admin-pro
changshu_adminPro
master

搜索帮助