Kaynağa Gözat

合并添加缓存策略

lex 1 yıl önce
ebeveyn
işleme
26df61f6f1

+ 11 - 2
dev-dist/sw.js

@@ -69,7 +69,7 @@ if (!self.define) {
   };
 }
 define(['./workbox-5357ef54'], function (workbox) {
-  'use strict';
+  ('use strict');
 
   self.skipWaiting();
   workbox.clientsClaim();
@@ -92,10 +92,19 @@ define(['./workbox-5357ef54'], function (workbox) {
     ],
     {}
   );
+  /**
+   * https://juejin.cn/post/6844903881189621767
+   * 缓存策略 有5种
+   */
   workbox.cleanupOutdatedCaches();
   workbox.registerRoute(
     new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
       allowlist: [/^\/$/]
-    })
+    }),
+    workbox.strategies.NetworkFirst()
+  );
+  workbox.routing.registerRoute(
+    new RegExp('.*.html|css|js'),
+    workbox.strategies.NetworkFirst()
   );
 });

+ 1 - 0
src/components/layout/layoutTop.tsx

@@ -148,6 +148,7 @@ export default defineComponent({
             <p>
               {/* {info.value.schoolInfos[0].tenantName} |{' '} */}
               {info.value?.schoolInfos[0]?.name || ''}
+              18:22
             </p>
           </div>
           <div class={styles.layoutRight}>

+ 1 - 2
src/views/login/index.tsx

@@ -134,7 +134,7 @@ export default defineComponent({
         </div>
         <div class={styles['view-account-form']}>
           <img class={styles.colLogo} src={colLogo}></img>
-          20:09!
+          18:22
           {isForgot.value ? (
             <NTabs
               key="forgotPassword"
@@ -171,7 +171,6 @@ export default defineComponent({
               </NTabPane>
             </NTabs>
           )}
-
           <div class={styles.alertWrap}>
             <div class={styles.alertInfo}>
               <NImage