Skip to content

Commit b2888e0

Browse files
committed
refactor: 增加 style 标签
1 parent 5f1f7b9 commit b2888e0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
@if (Model != null)
66
{
77
<CascadingValue Value="this" IsFixed="true">
8-
<EditForm Model="@Model" @attributes="@AdditionalAttributes" id="@Id" data-bb-dissubmit="@DisableAutoSubmitString" data-bb-invalid-result="@ShowAllInvalidResultString" OnValidSubmit="@OnValidSubmitForm" OnInvalidSubmit="@OnInvalidSubmitForm">
8+
<EditForm @attributes="@AdditionalAttributes" id="@Id" Model="@Model"
9+
data-bb-dissubmit="@DisableAutoSubmitString" data-bb-invalid-result="@ShowAllInvalidResultString"
10+
style="@StyleString"
11+
OnValidSubmit="@OnValidSubmitForm" OnInvalidSubmit="@OnInvalidSubmitForm">
912
<BootstrapBlazorDataAnnotationsValidator @ref="Validator" />
1013
@ChildContent
1114
</EditForm>

src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ public partial class ValidateForm
130130

131131
private string? ShowAllInvalidResultString => ShowAllInvalidResult ? "true" : null;
132132

133+
private string? StyleString => CssBuilder.Default()
134+
.AddClass($"--bb-row-label-width: {LabelWidth}px;", LabelWidth.HasValue)
135+
.Build();
136+
133137
/// <summary>
134138
/// OnParametersSet 方法
135139
/// </summary>

0 commit comments

Comments
 (0)