Skip to content

Commit 6a553ec

Browse files
committed
fix: menu render target path
1 parent fec00eb commit 6a553ec

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

β€Žsrc/components/Menu/menu.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ export default {
101101
},
102102
renderMenuItem (menu) {
103103
const target = menu.meta.target || null
104-
const props = {
105-
to: { name: menu.name },
106-
target: target
107-
}
104+
const tag = target && 'a' || 'router-link'
105+
const props = { to: { name: menu.name } }
106+
const attrs = { href: menu.path, target: menu.meta.target }
108107
return (
109108
<Item {...{ key: menu.path }}>
110-
<router-link {...{ props }}>
109+
<tag {...{ props, attrs }}>
111110
{this.renderIcon(menu.meta.icon)}
112111
<span>{menu.meta.title}</span>
113-
</router-link>
112+
</tag>
114113
</Item>
115114
)
116115
},

β€Žsrc/config/router.config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ export const asyncRouterMap = [
2525
component: () => import('@/views/dashboard/Analysis'),
2626
meta: { title: 'εˆ†ζžι‘΅', keepAlive: false, permission: [ 'dashboard' ] }
2727
},
28+
// 倖部链ζŽ₯
2829
{
29-
path: '/dashboard/monitor',
30+
path: 'https://www.baidu.com/',
3031
name: 'Monitor',
31-
hidden: true,
32-
component: () => import('@/views/dashboard/Monitor'),
33-
meta: { title: 'η›‘ζŽ§ι‘΅', keepAlive: true, permission: [ 'dashboard' ] }
32+
meta: { title: 'η›‘ζŽ§ι‘΅', target: '_blank' }
3433
},
3534
{
3635
path: '/dashboard/workplace',

0 commit comments

Comments
Β (0)