Skip to content

Commit 128ea9f

Browse files
committed
doc: 更新示例
1 parent de864bf commit 128ea9f

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/BootstrapBlazor.Server/Components/Samples/Tabs.razor

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,12 @@ private void Navigation()
497497
</DemoBlock>
498498

499499
<DemoBlock Title="@Localizer["TabsContextMenuTitle"]" Introduction="@Localizer["TabsContextMenuIntro"]" Name="ContextMenu">
500-
<Tab IsCard="true" ShowClose="true" TabStyle="TabStyle.Chrome" ShowToolbar="true" ShowContextMenu="true">
501-
<TabItem Text="@Localizer["TabItem1Text"]" Icon="fa-solid fa-user">
500+
<section ignore>
501+
<p>@((MarkupString)Localizer["TabsContextMenuDesc"].Value)</p>
502+
</section>
503+
<Tab IsCard="true" ShowClose="true" TabStyle="TabStyle.Chrome" ShowToolbar="true" ShowContextMenu="true"
504+
OnBeforeShowContextMenu="OnBeforeShowContextMenu">
505+
<TabItem Text="@Localizer["TabItem1Text"]" Icon="fa-solid fa-user" IsDisabled="true">
502506
<div>@Localizer["TabItem1Content"]</div>
503507
<Counter></Counter>
504508
</TabItem>

src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ private Task OnClickMenuItem(MenuItem item)
111111
return Task.CompletedTask;
112112
}
113113

114+
private async Task<bool> OnBeforeShowContextMenu(TabItem item)
115+
{
116+
await Task.Yield();
117+
return item.IsDisabled == false;
118+
}
119+
114120
private void AddTabItem(string text) => TabSetMenu.AddTab(new Dictionary<string, object?>
115121
{
116122
[nameof(TabItem.Text)] = text,

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,8 @@
21382138
"ContextCloseOther": "Close Other Tabs",
21392139
"ContextCloseAll": "Close All Tabs",
21402140
"TabsContextMenuTitle": "TabItem Context Menu",
2141-
"TabsContextMenuIntro": "Use the built-in <code>ContextMenuZone</code> component to pop up a custom context menu when you right-click a tab item"
2141+
"TabsContextMenuIntro": "Use the built-in <code>ContextMenuZone</code> component to pop up a custom context menu when you right-click a tab item",
2142+
"TabsContextMenuDesc": "For disabled tabs, you can set the <code>OnBeforeShowContextMenu</code> callback method to control whether the right-click menu is displayed. By default, it is displayed."
21422143
},
21432144
"BootstrapBlazor.Server.Components.Components.DemoTabItem": {
21442145
"Info": "Reset the title of this <code>TabItem</code> by click the button",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,8 @@
21382138
"ContextCloseOther": "关闭其他",
21392139
"ContextCloseAll": "关闭全部",
21402140
"TabsContextMenuTitle": "右键菜单",
2141-
"TabsContextMenuIntro": "通过内置 <code>ContextMenuZone</code> 组件,点击标签页右键时弹窗自定义右键菜单"
2141+
"TabsContextMenuIntro": "通过内置 <code>ContextMenuZone</code> 组件,点击标签页右键时弹窗自定义右键菜单",
2142+
"TabsContextMenuDesc": "被禁用的标签页可以通过设置 <code>OnBeforeShowContextMenu</code> 回调方法控制右键菜单是否显示,默认均显示"
21422143
},
21432144
"BootstrapBlazor.Server.Components.Components.DemoTabItem": {
21442145
"Info": "点击下方按钮,本 <code>TabItem</code> 标题更改为当前分钟与秒",

0 commit comments

Comments
 (0)