代码拉取完成,页面将自动刷新
/* 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)
},
})
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。