File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/BootstrapBlazor/Services Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments