From e02f6923593bd49f87caccd87e063baf312aaa3f Mon Sep 17 00:00:00 2001
From: 稚屿 <1491182878@qq.com>
Date: 星期一, 22 八月 2022 14:19:08 +0800
Subject: [PATCH] 修复菜单管理已知问题 问题描述:在菜单管理下,类型为菜单或者按钮的条目下点击修改按钮。 情况1,如果是类型为菜单,第一次点击修改按钮正常,则第二次点击另一个条目后面的修改按钮时报错! 情况2,如果是类型为按钮,第一次点击修改时正常,当点击取消按钮关闭弹窗时,浏览器报错!

---
 ruoyi-ui/src/components/TopNav/index.vue |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue
index cabb258..0cc24db 100644
--- a/ruoyi-ui/src/components/TopNav/index.vue
+++ b/ruoyi-ui/src/components/TopNav/index.vue
@@ -30,13 +30,14 @@
 <script>
 import { constantRoutes } from "@/router";
 
+// 隐藏侧边栏路由
+const hideList = ['/index', '/user/profile'];
+
 export default {
   data() {
     return {
       // 顶部栏初始数
       visibleNumber: 5,
-      // 是否为首次加载
-      isFrist: false,
       // 当前激活菜单的 index
       currentIndex: undefined
     };
@@ -88,17 +89,10 @@
     activeMenu() {
       const path = this.$route.path;
       let activePath = path;
-      if (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("/"));
         this.$store.dispatch('app/toggleSideBarHide', false);
-      } else if ("/index" == path || "" == path) {
-        if (!this.isFrist) {
-          this.isFrist = true;
-        } else {
-          activePath = "index";
-        }
-        this.$store.dispatch('app/toggleSideBarHide', true);
       } else if(!this.$route.children) {
         activePath = path;
         this.$store.dispatch('app/toggleSideBarHide', true);

--
Gitblit v1.9.2