Skip to content

Commit 4a71e64

Browse files
committed
refactor: 重构代码
1 parent feabe50 commit 4a71e64

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/BootstrapBlazor/Components/Tab/Tab.razor.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,15 +602,8 @@ private void AddTabItem(string url)
602602
}
603603
else
604604
{
605-
var menu = GetMenuItem(url);
606-
if (menu != null)
607-
{
608-
SetTabItemParameters(menu.Text, menu.Icon, true, true);
609-
}
610-
else
611-
{
612-
parameters.Add(nameof(TabItem.Text), url.Split("/").FirstOrDefault());
613-
}
605+
var menu = GetMenuItem(url) ?? new MenuItem() { Text = url.Split("/").FirstOrDefault() };
606+
SetTabItemParameters(menu.Text, menu.Icon, true, true);
614607
}
615608
parameters.Add(nameof(TabItem.Url), url);
616609

0 commit comments

Comments
 (0)