Commit 471175b40685abbd9f0650e0f7b450d95e83d8b3

Authored by YunaiV
1 parent 62cc1206

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

yudao-ui-admin/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 };
... ...