feat: support href router

This commit is contained in:
Uyarn 2022-03-08 22:19:57 +08:00
parent 1ac4690a79
commit 1eaf7e563d

View File

@ -37,6 +37,19 @@ const renderIcon = (item) => {
const useRenderNav = (list: Array<MenuRoute>) => { const useRenderNav = (list: Array<MenuRoute>) => {
return list.map((item) => { return list.map((item) => {
if (!item.children || !item.children.length || item.meta?.single) { 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 ( return (
<t-menu-item <t-menu-item
name={item.path} name={item.path}