mo 1 năm trước cách đây
mục cha
commit
bae089bed8
3 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 1 1
      public/version.json
  2. 6 0
      src/components/RouterError/index.tsx
  3. 3 1
      src/plugins/version.ts

+ 1 - 1
public/version.json

@@ -1 +1 @@
-{"version":1693831864713}
+{ "version": 1693832069219 }

+ 6 - 0
src/components/RouterError/index.tsx

@@ -42,7 +42,13 @@ export default defineComponent({
         // });
       }
     });
+    router.beforeEach(async (to, from, next) => {
+        if(await versionCheck()){
+          const showModalMask = ref(true)
+        }
+      next();
 
+    });
     const checkNewVersion = async () => {
       if ('serviceWorker' in navigator) {
         // let refreshing = false

+ 3 - 1
src/plugins/version.ts

@@ -11,7 +11,7 @@ const writeVersion = (versionFile: any, content: any) => {
 
 export default (options: any) => {
   let config: any;
-
+  console.log('加载插件');
   return {
     name: 'version-update',
     configResolved(resolvedConfig: any) {
@@ -29,7 +29,9 @@ export default (options: any) => {
         writeVersion(file, content);
       } else {
         fs.mkdir(config.publicDir, err => {
+          console.log(err, '引入报错了');
           if (err) throw err;
+
           writeVersion(file, content);
         });
       }