Skip to content

Commit 62cc3c2

Browse files
committed
feat: 更改为服务
1 parent 229fedd commit 62cc3c2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/BootstrapBlazor/Components/Title/TitleService.cs renamed to src/BootstrapBlazor/Services/TitleService.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ namespace BootstrapBlazor.Components;
88
/// <summary>
99
/// Title 服务
1010
/// </summary>
11-
public class TitleService : BootstrapServiceBase<TitleOption>
11+
public class TitleService(IJSRuntime jSRuntime)
1212
{
13+
[NotNull]
14+
private JSModule? _module = null;
15+
1316
/// <summary>
1417
/// 设置当前网页 Title 方法
1518
/// </summary>
1619
/// <returns></returns>
17-
public async Task SetTitle(string title)
20+
public async Task SetTitle(string title, CancellationToken token = default)
1821
{
19-
var op = new TitleOption() { Title = title };
20-
await Invoke(op);
22+
_module ??= await jSRuntime.LoadModule("./_content/BootstrapBlazor/modules/utility.js");
23+
await _module.InvokeVoidAsync("setTitle", token, title);
2124
}
2225
}

0 commit comments

Comments
 (0)