瀏覽代碼

修复开启TopNav后,左侧打开外链问题

RuoYi 5 年之前
父節點
當前提交
d04a93d75d
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      ruoyi-ui/src/components/TopNav/index.vue

+ 7 - 2
ruoyi-ui/src/components/TopNav/index.vue

@@ -73,7 +73,9 @@ export default {
73 73
             if(router.path === "/") {
74 74
               router.children[item].path = "/redirect/" + router.children[item].path;
75 75
             } else {
76
-              router.children[item].path = router.path + "/" + router.children[item].path;
76
+			  if(!this.ishttp(router.children[item].path)) {
77
+                router.children[item].path = router.path + "/" + router.children[item].path;
78
+			  }
77 79
             }
78 80
             router.children[item].parentPath = router.path;
79 81
           }
@@ -122,7 +124,7 @@ export default {
122 124
     // 菜单选择事件
123 125
     handleSelect(key, keyPath) {
124 126
       this.currentIndex = key;
125
-      if (key.indexOf("http://") !== -1 || key.indexOf("https://") !== -1) {
127
+      if (this.ishttp(key)) {
126 128
         // http(s):// 路径新窗口打开
127 129
         window.open(key, "_blank");
128 130
       } else if (key.indexOf("/redirect") !== -1) {
@@ -147,6 +149,9 @@ export default {
147 149
         this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
148 150
       }
149 151
       return routes;
152
+    },
153
+	ishttp(url) {
154
+      return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
150 155
     }
151 156
   },
152 157
 };