Skip to content

Commit 9c5627b

Browse files
committed
Revert "refactor: 使用代码生成组件支持 @OnClick 写法"
This reverts commit c81d0a9.
1 parent c9d3f45 commit 9c5627b

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@namespace BootstrapBlazor.Components
2+
@inherits DisplayBase<string>
3+
4+
<DynamicElement @attributes="@AdditionalAttributes" TagName="@TagName" class="@ClassString" style="@StyleString" required="@Required">
5+
@if (ChildContent != null)
6+
{
7+
@ChildContent
8+
}
9+
else
10+
{
11+
@DisplayText
12+
}
13+
</DynamicElement>

src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.cs renamed to src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.razor.cs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
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-
86
namespace BootstrapBlazor.Components;
97

108
/// <summary>
119
/// BootstrapInputGroupLabel 组件
1210
/// </summary>
13-
public sealed class BootstrapInputGroupLabel : DisplayBase<string>
11+
public partial class BootstrapInputGroupLabel
1412
{
1513
private string? ClassString => CssBuilder.Default()
1614
.AddClass("input-group-text", IsInputGroupLabel)
@@ -56,7 +54,7 @@ public sealed class BootstrapInputGroupLabel : DisplayBase<string>
5654
private bool IsInputGroupLabel => InputGroup != null;
5755

5856
/// <summary>
59-
/// <inheritdoc/>
57+
/// OnParametersSet 方法
6058
/// </summary>
6159
protected override void OnParametersSet()
6260
{
@@ -67,26 +65,4 @@ protected override void OnParametersSet()
6765
DisplayText ??= FieldIdentifier?.GetDisplayName();
6866
}
6967
}
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-
}
9268
}

0 commit comments

Comments
 (0)