Commit 4cb4de86dbdd30a7d1382233b6c01265185a8261
1 parent
c861b78f
修复首页搜索菜单外链无法点击跳转问题
Showing
1 changed file
with
10 additions
and
2 deletions
ruoyi-ui/src/components/HeaderSearch/index.vue
| ... | ... | @@ -70,7 +70,12 @@ export default { |
| 70 | 70 | this.show = false |
| 71 | 71 | }, |
| 72 | 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 | 79 | this.search = '' |
| 75 | 80 | this.options = [] |
| 76 | 81 | this.$nextTick(() => { |
| ... | ... | @@ -104,7 +109,7 @@ export default { |
| 104 | 109 | if (router.hidden) { continue } |
| 105 | 110 | |
| 106 | 111 | const data = { |
| 107 | - path: path.resolve(basePath, router.path), | |
| 112 | + path: !this.ishttp(router.path) ? path.resolve(basePath, router.path) : router.path, | |
| 108 | 113 | title: [...prefixTitle] |
| 109 | 114 | } |
| 110 | 115 | |
| ... | ... | @@ -134,6 +139,9 @@ export default { |
| 134 | 139 | } else { |
| 135 | 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 | } | ... | ... |