Pārlūkot izejas kodu

fix:路由问题

lvkun996 3 gadi atpakaļ
vecāks
revīzija
558beeaeb0
5 mainītis faili ar 28 papildinājumiem un 2 dzēšanām
  1. 2 2
      public/index.html
  2. BIN
      public/logo.ico
  3. 4 0
      src/layout/navbar.vue
  4. 20 0
      src/router/index.ts
  5. 2 0
      src/store/router.ts

+ 2 - 2
public/index.html

@@ -4,8 +4,8 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <link rel="icon" href="logo.ico">
+    <title>蛟龙云联</title>
   </head>
   <body>
     <noscript>

BIN
public/logo.ico


+ 4 - 0
src/layout/navbar.vue

@@ -47,9 +47,13 @@ const changeRouter = (path: string) => appRouter.changeNavbar(path)
 .header {
   width: 100vw;
   display: flex;
+  height: 50px;
   .logo {
     width: 170px;
     color: #fff;
   }
+  .ant-menu {
+    height: 50px;
+  }
 }
 </style>

+ 20 - 0
src/router/index.ts

@@ -21,6 +21,26 @@ const routes: Array<ROUTER.RoutesProps> = [
       }
     ]
   },
+  {
+    path: '/visual',
+    name: '视觉平台',
+    title: '视觉平台',
+    component: () => import('@/layout/layout.vue'),
+    children: [
+      {
+        path: '/visual-dashboard',
+        name: '仪表盘',
+        component: () => import('@/pages/Dashboard/index.vue'),
+        children: [
+          {
+            path: '/visual-dashboard-item',
+            name: '仪表盘item',
+            component: () => import('@/pages/Dashboard/index.vue')
+          }
+        ]
+      }
+    ]
+  },
   {
     path: '/iot',
     name: '物联网',

+ 2 - 0
src/store/router.ts

@@ -60,6 +60,8 @@ export const useAppRouter = defineStore(ConstantStore.ROUTER, () => {
   watch(
     () => RootRouter.currentRoute.value.path,
     () => {
+      console.log('RootRouter.currentRoute.value.path:', RootRouter.currentRoute.value)
+
       appRouter.sider = {
         route: RootRouter.getRoutes().find(item => item.path === appRouter.navbar!.selectPath)?.children as ROUTER.RoutesProps[],
         selectPath: RootRouter.currentRoute.value.path,