File tree Expand file tree Collapse file tree 4 files changed +6
-59
lines changed Expand file tree Collapse file tree 4 files changed +6
-59
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ namespace BootstrapBlazor.Components;
88/// <summary>
99/// Title 组件
1010/// </summary>
11- [ BootstrapModuleAutoLoader ( ModuleName = "title" , AutoInvokeInit = false , AutoInvokeDispose = false ) ]
12- public class Title : BootstrapModuleComponentBase
11+ public class Title : ComponentBase
1312{
1413 [ Inject ]
1514 [ NotNull ]
@@ -21,16 +20,6 @@ public class Title : BootstrapModuleComponentBase
2120 [ Parameter ]
2221 public string ? Text { get ; set ; }
2322
24- /// <summary>
25- /// OnInitialized 方法
26- /// </summary>
27- protected override void OnInitialized ( )
28- {
29- base . OnInitialized ( ) ;
30-
31- TitleService . Register ( this , SetTitle ) ;
32- }
33-
3423 /// <summary>
3524 /// <inheritdoc/>
3625 /// </summary>
@@ -42,33 +31,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
4231
4332 if ( firstRender && Text != null )
4433 {
45- var op = new TitleOption ( ) { Title = Text } ;
46- await SetTitle ( op ) ;
47- }
48- }
49-
50- private async Task SetTitle ( TitleOption op )
51- {
52- if ( Module != null )
53- {
54- await InvokeVoidAsync ( "setTitle" , op . Title ) ;
55- }
56- else
57- {
58- Text = op . Title ;
59- }
60- }
61-
62- /// <summary>
63- /// <inheritdoc/>
64- /// </summary>
65- protected override async ValueTask DisposeAsync ( bool disposing )
66- {
67- await base . DisposeAsync ( disposing ) ;
68-
69- if ( disposing )
70- {
71- TitleService . UnRegister ( this ) ;
34+ await TitleService . SetTitle ( Text ) ;
7235 }
7336 }
7437}
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -791,6 +791,10 @@ const deepMerge = (obj1, obj2) => {
791791 return obj1 ;
792792}
793793
794+ export function setTitle ( title ) {
795+ document . title = title ;
796+ }
797+
794798export {
795799 autoAdd ,
796800 autoRemove ,
You can’t perform that action at this time.
0 commit comments