From 2e2e215ef7df7c4421d99f8f874e0d4c3f233311 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Thu, 14 Sep 2023 18:49:48 +0800
Subject: [PATCH] 添加导航高亮

---
 src/components/common/topbar.vue |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/components/common/topbar.vue b/src/components/common/topbar.vue
index 72cd5f2..6b6cde7 100644
--- a/src/components/common/topbar.vue
+++ b/src/components/common/topbar.vue
@@ -44,9 +44,17 @@
 import { ELocalStorageKey, ERouterName } from '/@/types'
 import { UserOutlined, ExportOutlined } from '@ant-design/icons-vue'
 import cloudapi from '/@/assets/icons/cloudapi.png'
-
 const root = getRoot()
-
+const selected = ref<string>(root.$route.path)
+const route = useRoute()
+watch(route, (newVal) => {
+  if (newVal) {
+    selected.value = newVal.path
+    console.log(selected.value, '+++++')
+  }
+}, {
+  immediate: true,
+})
 interface IOptions {
   key: number
   label: string
@@ -62,13 +70,11 @@
 const workspaceName = ref('')
 
 const options = [
-  { key: 0, label: '项目', path: '/' + ERouterName.PROJECT },
+  { key: 0, label: '项目', path: '/' + ERouterName.PROJECT_LIST },
   { key: 1, label: '人员管理', path: '/' + ERouterName.MEMBERS },
   { key: 2, label: '设备管理', path: '/' + ERouterName.DEVICES },
   // { key: 3, label: ERouterName.FIRMWARES.charAt(0).toUpperCase() + ERouterName.FIRMWARES.substr(1), path: '/' + ERouterName.FIRMWARES },
 ]
-
-const selected = ref<string>(root.$route.path)
 
 onMounted(() => {
   // getPlatformInfo().then(res => {

--
Gitblit v1.9.3