Ver código fonte

修复首页搜索菜单外链无法点击跳转问题

RuoYi 5 anos atrás
pai
commit
cc0cfdcf7e
1 arquivos alterados com 10 adições e 2 exclusões
  1. 10 2
      ruoyi-ui/src/components/HeaderSearch/index.vue

+ 10 - 2
ruoyi-ui/src/components/HeaderSearch/index.vue

@@ -70,7 +70,12 @@ export default {
70
       this.show = false
70
       this.show = false
71
     },
71
     },
72
     change(val) {
72
     change(val) {
73
-      this.$router.push(val.path)
73
+      if(this.ishttp(val.path)) {
74
+        // http(s):// 路径新窗口打开
75
+        window.open(val.path, "_blank");
76
+      } else {
77
+        this.$router.push(val.path)
78
+      }
74
       this.search = ''
79
       this.search = ''
75
       this.options = []
80
       this.options = []
76
       this.$nextTick(() => {
81
       this.$nextTick(() => {
@@ -104,7 +109,7 @@ export default {
104
         if (router.hidden) { continue }
109
         if (router.hidden) { continue }
105
 
110
 
106
         const data = {
111
         const data = {
107
-          path: path.resolve(basePath, router.path),
112
+          path: !this.ishttp(router.path) ? path.resolve(basePath, router.path) : router.path,
108
           title: [...prefixTitle]
113
           title: [...prefixTitle]
109
         }
114
         }
110
 
115
 
@@ -134,6 +139,9 @@ export default {
134
       } else {
139
       } else {
135
         this.options = []
140
         this.options = []
136
       }
141
       }
142
+    },
143
+    ishttp(url) {
144
+      return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
137
     }
145
     }
138
   }
146
   }
139
 }
147
 }