diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs index 656ca3db445..ad0babd0d43 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs @@ -226,6 +226,22 @@ private AttributeItem[] GetAttributes() => DefaultValue = "false" }, new() + { + Name = "ShowExtendButtons", + Description = Localizer["TabAttrShowNavigatorButtons"].Value, + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new() + { + Name = "ShowExtendButtons", + Description = Localizer["TabAttrShowActiveBar"].Value, + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new() { Name = "ClickTabToNavigation", Description = Localizer["TabAtt6ClickTabToNavigation"].Value, @@ -369,7 +385,6 @@ private AttributeItem[] GetAttributes() => /// private MethodItem[] GetMethods() => [ - new MethodItem() { Name = "AddTab", diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 867cde16d73..f1137fb0d1f 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -2085,6 +2085,8 @@ "TabAtt3IsOnlyRenderActiveTab": "Whether to render only Active labels", "TabAtt4ShowClose": "Whether to display the close button", "TabAtt5ShowExtendButtons": "Whether to display the extension button", + "TabAttShowNavigatorButtons": "Whether to display the previous and next navigation buttons", + "TabAttShowActiveBar": "Whether to display active bar", "TabAtt6ClickTabToNavigation": "Whether to navigate when you click on the title", "TabAtt7Placement": "Set the label position", "TabAtt8Height": "Set the label height", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 6603ae440b0..30780cc1212 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -2085,6 +2085,8 @@ "TabAtt3IsOnlyRenderActiveTab": "是否仅渲染 Active 标签", "TabAtt4ShowClose": "是否显示关闭按钮", "TabAtt5ShowExtendButtons": "是否显示扩展按钮", + "TabAttShowNavigatorButtons": "是否显示前后导航按钮", + "TabAttShowActiveBar": "是否显示活动标签", "TabAtt6ClickTabToNavigation": "点击标题时是否导航", "TabAtt7Placement": "设置标签位置", "TabAtt8Height": "设置标签高度", diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor b/src/BootstrapBlazor/Components/Tab/Tab.razor index f67b68edf5f..98e1797da09 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor @@ -81,7 +81,7 @@ else
} - @if (!IsCard && !IsBorderCard) + @if (!IsCard && !IsBorderCard && ShowActiveBar) {
} diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs index 205be895551..f3366c1c241 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs @@ -126,11 +126,17 @@ public partial class Tab : IHandlerException public bool ShowExtendButtons { get; set; } /// - /// 获得/设置 是否显示导航按钮 默认为 true 显示 + /// 获得/设置 是否显示前后导航按钮 默认为 true 显示 /// [Parameter] public bool ShowNavigatorButtons { get; set; } = true; + /// + /// 获得/设置 是否显示活动标签 默认为 true 显示 + /// + [Parameter] + public bool ShowActiveBar { get; set; } = true; + /// /// 获得/设置 点击 TabItem 时是否自动导航 默认为 false 不导航 /// diff --git a/test/UnitTest/Components/TabTest.cs b/test/UnitTest/Components/TabTest.cs index 2def43335f9..426f647340f 100644 --- a/test/UnitTest/Components/TabTest.cs +++ b/test/UnitTest/Components/TabTest.cs @@ -655,6 +655,28 @@ public void ShowNavigatorButtons_Ok() Assert.Empty(links); } + [Fact] + public void ShowActiveBar_Ok() + { + var cut = Context.RenderComponent(pb => + { + pb.Add(a => a.AdditionalAssemblies, new Assembly[] { GetType().Assembly }); + pb.Add(a => a.ShowActiveBar, true); + pb.AddChildContent(pb => + { + pb.Add(a => a.Text, "Tab1"); + pb.Add(a => a.Url, "/Cat"); + }); + }); + cut.Contains("
"); + + cut.SetParametersAndRender(pb => + { + pb.Add(a => a.ShowActiveBar, false); + }); + cut.DoesNotContain("
"); + } + [Fact] public void Text_Ok() {