Skip to content

Commit dbb3a11

Browse files
committed
doc: 增加追悼模式实战网页
1 parent a019197 commit dbb3a11

File tree

5 files changed

+45
-2
lines changed

5 files changed

+45
-2
lines changed

src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ protected override async Task OnInitializedAsync()
110110
{
111111
Text = Localizer["OnlineSheet"],
112112
Url = "tutorials/online-sheet",
113+
},
114+
new()
115+
{
116+
Text = Localizer["MemorialMode"],
117+
Url = "tutorials/memorial",
113118
}
114119
]);
115120
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@page "/tutorials/memorial"
2+
3+
<Button Text="切换哀悼模式" OnClick="OnToggle" class="mb-3"></Button>
4+
5+
<p class="code-label">1. 加载 <code>Utlity</code> 工具</p>
6+
<Pre>var module = await JSRuntime.LoadUtility();</Pre>
7+
8+
<p class="code-label">2. 设置哀悼模式</p>
9+
<Pre>await module.InvokeVoidAsync("SetMemorial", true);</Pre>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
5+
6+
using Microsoft.JSInterop;
7+
8+
namespace BootstrapBlazor.Server.Components.Samples.Tutorials;
9+
10+
/// <summary>
11+
/// 追悼模式
12+
/// </summary>
13+
public partial class Memorial
14+
{
15+
[Inject, NotNull]
16+
private IJSRuntime? JSRuntime { get; set; }
17+
18+
private bool _isMemorial = false;
19+
20+
private async Task OnToggle()
21+
{
22+
var module = await JSRuntime.LoadUtility();
23+
24+
_isMemorial = !_isMemorial;
25+
await module.SetMemorialModeAsync(_isMemorial);
26+
}
27+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"TranslateSummary": "Translate",
2323
"DrawingSummary": "Drawing",
2424
"AdminSummary": "Admin",
25-
"OnlineSheet": "UniverSheet"
25+
"OnlineSheet": "UniverSheet",
26+
"MemorialMode": "Memorial"
2627
},
2728
"BootstrapBlazor.Server.Components.Components.Pre": {
2829
"LoadingText": "Loading ...",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"TranslateSummary": "翻译工具 Translate",
2323
"DrawingSummary": "画图 Drawing",
2424
"AdminSummary": "中台 Admin",
25-
"OnlineSheet": "在线表格 UniverSheet"
25+
"OnlineSheet": "在线表格 UniverSheet",
26+
"MemorialMode": "追悼模式"
2627
},
2728
"BootstrapBlazor.Server.Components.Components.Pre": {
2829
"LoadingText": "正在加载 ...",

0 commit comments

Comments
 (0)