Browse Source

fix: 修复清空缓存并退出登陆后再次进入页面routerArrays未初始化问题

xiaoxian521 3 years ago
parent
commit
ee7241da3f
2 changed files with 27 additions and 23 deletions
  1. 15 11
      src/layout/components/tag/index.vue
  2. 12 12
      src/layout/types.ts

+ 15 - 11
src/layout/components/tag/index.vue

@@ -1,3 +1,17 @@
+<script lang="ts">
+let routerArrays: Array<RouteConfigs> = [
+  {
+    path: "/welcome",
+    parentPath: "/",
+    meta: {
+      title: "message.hshome",
+      icon: "el-icon-s-home",
+      showLink: true
+    }
+  }
+];
+</script>
+
 <script setup lang="ts">
 import {
   ref,
@@ -35,17 +49,7 @@ const router = useRouter();
 const showTags = ref(storageLocal.getItem("tagsVal") || false);
 const containerDom = templateRef<HTMLElement | null>("containerDom", null);
 const activeIndex = ref(-1);
-let routerArrays: Array<RouteConfigs> = [
-  {
-    path: "/welcome",
-    parentPath: "/",
-    meta: {
-      title: "message.hshome",
-      icon: "el-icon-s-home",
-      showLink: true
-    }
-  }
-];
+
 const tagsViews = ref<Array<tagsViewsType>>([
   {
     icon: refresh,

+ 12 - 12
src/layout/types.ts

@@ -1,3 +1,15 @@
+export const routerArrays: Array<RouteConfigs> = [
+  {
+    path: "/welcome",
+    parentPath: "/",
+    meta: {
+      title: "message.hshome",
+      icon: "el-icon-s-home",
+      showLink: true
+    }
+  }
+];
+
 export type RouteConfigs = {
   path?: string;
   parentPath?: string;
@@ -36,18 +48,6 @@ export interface setType {
   };
 }
 
-export const routerArrays: Array<RouteConfigs> = [
-  {
-    path: "/welcome",
-    parentPath: "/",
-    meta: {
-      title: "message.hshome",
-      icon: "el-icon-s-home",
-      showLink: true
-    }
-  }
-];
-
 export type childrenType = {
   path?: string;
   noShowingChildren?: boolean;