mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 10:58:25 +08:00
feat: support href router
This commit is contained in:
parent
1ac4690a79
commit
1eaf7e563d
|
@ -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}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user