mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 07:28:24 +08:00
Merge pull request #87 from Tencent/feat/support-href-link
feat: 路由支持配置跳转外链
This commit is contained in:
commit
1b983a3203
|
@ -37,6 +37,19 @@ const renderIcon = (item) => {
|
|||
const useRenderNav = (list: Array<MenuRoute>) => {
|
||||
return list.map((item) => {
|
||||
if (!item.children || !item.children.length || item.meta?.single) {
|
||||
const href = item.path.match(/(http|https):\/\/([\w.]+\/?)\S*/);
|
||||
if (href) {
|
||||
return (
|
||||
<t-menu-item
|
||||
href={href?.[0]}
|
||||
name={item.path}
|
||||
value={item.meta?.single ? item.redirect : item.path}
|
||||
icon={renderIcon(item)}
|
||||
>
|
||||
{item.title}
|
||||
</t-menu-item>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<t-menu-item
|
||||
name={item.path}
|
||||
|
|
Loading…
Reference in New Issue
Block a user