Skip to content

Commit 8e58714

Browse files
committed
refactor: 重构代码
1 parent b6d7990 commit 8e58714

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ public partial class Tab
197197
/// 获得/设置 Gets or sets a collection of additional assemblies that should be searched for components that can match URIs.
198198
/// </summary>
199199
[Parameter]
200-
[NotNull]
201200
public IEnumerable<Assembly>? AdditionalAssemblies { get; set; }
202201

203202
/// <summary>
@@ -529,15 +528,6 @@ protected override void OnParametersSet()
529528
ContextMenuCloseAllIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuCloseAllIcon);
530529
ContextMenuFullScreenIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuFullScreenIcon);
531530

532-
if (AdditionalAssemblies is null)
533-
{
534-
var entryAssembly = Assembly.GetEntryAssembly();
535-
if (entryAssembly is not null)
536-
{
537-
AdditionalAssemblies = [entryAssembly];
538-
}
539-
}
540-
541531
if (Placement != Placement.Top && TabStyle == TabStyle.Chrome)
542532
{
543533
TabStyle = TabStyle.Default;
@@ -814,8 +804,11 @@ public void AddTab(string url, string text, string? icon = null, bool active = t
814804
StateHasChanged();
815805
}
816806

807+
private static List<Assembly> GetAdditionalAssemblies() => [Assembly.GetEntryAssembly()!];
808+
817809
private void AddTabItem(string url)
818810
{
811+
AdditionalAssemblies ??= GetAdditionalAssemblies();
819812
var parameters = new Dictionary<string, object?>
820813
{
821814
{ nameof(TabItem.Url), url }

0 commit comments

Comments
 (0)