Skip to content

Commit 9b706e6

Browse files
committed
doc: 增加右键菜单刷新示例
1 parent 01e62b7 commit 9b706e6

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ private void Navigation()
501501
<Tab IsCard="true" ShowClose="true" TabStyle="TabStyle.Chrome" ShowToolbar="true" @ref="_tab">
502502
<TabItem Text="@Localizer["TabItem1Text"]" Icon="fa-solid fa-user">
503503
<div>@Localizer["TabItem1Content"]</div>
504+
<Counter></Counter>
504505
</TabItem>
505506
<TabItem Text="@Localizer["TabItem2Text"]" Icon="fa-solid fa-gauge-high">
506507
<div>@Localizer["TabItem2Content"]</div>
@@ -513,6 +514,8 @@ private void Navigation()
513514
</TabItem>
514515
</Tab>
515516
<ContextMenu>
517+
<ContextMenuItem Icon="fa-solid fa-rotate-right" Text="@Localizer["ContextRefresh"]" OnClick="OnRefrsh"></ContextMenuItem>
518+
<ContextMenuDivider></ContextMenuDivider>
516519
<ContextMenuItem Icon="fa-solid fa-xmark" Text="@Localizer["ContextClose"]" OnClick="OnClose"></ContextMenuItem>
517520
<ContextMenuItem Icon="fa-solid fa-left-right" Text="@Localizer["ContextCloseOther"]" OnClick="OnCloseOther"></ContextMenuItem>
518521
<ContextMenuItem Icon="fa-solid fa-arrows-left-right-to-line" Text="@Localizer["ContextCloseAll"]" OnClick="OnCloseAll"></ContextMenuItem>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ private Task OnSetTitle(string text)
174174
[NotNull]
175175
private Tab? _tab = null;
176176

177+
private Task OnRefrsh(ContextMenuItem item, object? context)
178+
{
179+
if (context is TabItem tabItem)
180+
{
181+
_tab.Refresh(tabItem);
182+
}
183+
return Task.CompletedTask;
184+
}
185+
177186
private async Task OnClose(ContextMenuItem item, object? context)
178187
{
179188
if (context is TabItem tabItem)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,7 @@
21332133
"AttributeFullscreenToolbarButtonIcon": "Toolbar full screen button icon",
21342134
"TabsToolbarDesc": "After clicking the button, the counter value increases, and clicking the <b>Refresh</b> button on the toolbar will reset the counter.",
21352135
"AttributeOnToolbarRefreshCallback": "Click the toolbar refresh button callback method",
2136+
"ContextRefresh": "Refresh",
21362137
"ContextClose": "Close",
21372138
"ContextCloseOther": "Close Other Tabs",
21382139
"ContextCloseAll": "Close All Tabs",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,7 @@
21332133
"AttributeFullscreenToolbarButtonIcon": "工具栏全屏按钮图标",
21342134
"TabsToolbarDesc": "点击按钮计数器数值增加后,点击工具栏的 <b>刷新</b> 按钮计数器清零",
21352135
"AttributeOnToolbarRefreshCallback": "点击工具栏刷新按钮回调方法",
2136+
"ContextRefresh": "刷新",
21362137
"ContextClose": "关闭",
21372138
"ContextCloseOther": "关闭其他",
21382139
"ContextCloseAll": "关闭全部",

0 commit comments

Comments
 (0)