我有vue申请。我看到workbox-sw默认是从vue安装在我的应用程序中的。
如何配置工作箱以显示页面(仅显示单词:You're offline now
)?现在,该工作框将当前页面保存在缓存中并显示它。
Here I found code显示离线页面。但是如何将其集成到我的Workbox Vue应用程序中呢?我没有this.addEventListener('fetch'...
或this.addEventListener('install',...
。
这是Vue给我的代码:
import { register } from 'register-service-worker';
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');
},
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.');
},
updated() {
console.log('New content is available; please refresh.');
},
offline() {
console.log('No internet connection found. App is running in offline mode.');
},
error(error) {
console.error('Error during service worker registration:', error);
},
});
norton.com/setup赛门铁克诺顿免费电话:1-833-807-7701。诺顿防病毒软件是赛门铁克的产品,是一种快速而强大的防病毒软件,可为间谍软件,病毒和其他威胁提供高质量的计算机保护。它还具有网络保护功能,可帮助您轻松访问Internet,而无需担心。