作者 RuoYi

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

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