From b16e8cb3f625b40ba176758297ffab016e664603 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 30 Mar 2022 10:34:40 +0800 Subject: [PATCH] =?UTF-8?q?topNav=E8=87=AA=E5=AE=9A=E4=B9=89=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TopNav/index.vue | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index 853e48f..e3e5c97 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -33,10 +33,10 @@ import { isHttp } from '@/utils/validate' // 顶部栏初始数 const visibleNumber = ref(null); -// 是否为首次加载 -const isFrist = ref(null); // 当前激活菜单的 index const currentIndex = ref(null); +// 隐藏侧边栏路由 +const hideList = ['/index', '/user/profile']; const store = useStore(); const route = useRoute(); @@ -88,17 +88,10 @@ const childrenMenus = computed(() => { const activeMenu = computed(() => { const path = route.path; let activePath = path; - if (path !== undefined && path.lastIndexOf("/") > 0) { + if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) { const tmpPath = path.substring(1, path.length); activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/")); store.dispatch('app/toggleSideBarHide', false); - } else if ("/index" == path || "" == path) { - if (!isFrist.value) { - isFrist.value = true; - } else { - activePath = "index"; - } - store.dispatch('app/toggleSideBarHide', true); } else if(!route.children) { activePath = path; store.dispatch('app/toggleSideBarHide', true);