33// See the LICENSE file in the project root for more information.
44// Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 55
6+ using Microsoft . AspNetCore . Components . Rendering ;
7+
68namespace BootstrapBlazor . Components ;
79
810/// <summary>
911/// BootstrapInputGroupLabel 组件
1012/// </summary>
11- public partial class BootstrapInputGroupLabel
13+ public sealed class BootstrapInputGroupLabel : DisplayBase < string >
1214{
1315 private string ? ClassString => CssBuilder . Default ( )
1416 . AddClass ( "input-group-text" , IsInputGroupLabel )
@@ -54,7 +56,7 @@ public partial class BootstrapInputGroupLabel
5456 private bool IsInputGroupLabel => InputGroup != null ;
5557
5658 /// <summary>
57- /// OnParametersSet 方法
59+ /// <inheritdoc/>
5860 /// </summary>
5961 protected override void OnParametersSet ( )
6062 {
@@ -65,4 +67,26 @@ protected override void OnParametersSet()
6567 DisplayText ??= FieldIdentifier ? . GetDisplayName ( ) ;
6668 }
6769 }
70+
71+ /// <summary>
72+ /// <inheritdoc/>
73+ /// </summary>
74+ /// <param name="builder"></param>
75+ protected override void BuildRenderTree ( RenderTreeBuilder builder )
76+ {
77+ builder . OpenElement ( 0 , TagName ) ;
78+ builder . AddMultipleAttributes ( 1 , AdditionalAttributes ) ;
79+ builder . AddAttribute ( 2 , "class" , ClassString ) ;
80+ builder . AddAttribute ( 3 , "style" , StyleString ) ;
81+ builder . AddAttribute ( 4 , "required" , Required ) ;
82+ if ( ChildContent != null )
83+ {
84+ builder . AddContent ( 5 , ChildContent ) ;
85+ }
86+ else
87+ {
88+ builder . AddContent ( 6 , DisplayText ) ;
89+ }
90+ builder . CloseElement ( ) ;
91+ }
6892}
0 commit comments