Skip to content

Commit 3fbd406

Browse files
committed
refactor: 增加占位符
1 parent 9b847fa commit 3fbd406

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

src/BootstrapBlazor.Server/Components/Samples/OtpInputs.razor

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@
4040
Introduction="@Localizer["OtpInputsTypeIntro"]"
4141
Name="Type">
4242
<div class="row g-3">
43-
<div class="col-12"><Select @bind-Value="_otpInputType"></Select></div>
44-
<div class="col-12"><OtpInput Value="@_value" Type="_otpInputType"></OtpInput></div>
43+
<div class="col-12 col-sm-6">
44+
<BootstrapInputGroup>
45+
<BootstrapInputGroupLabel DisplayText="Type"></BootstrapInputGroupLabel>
46+
<Select @bind-Value="_otpInputType"></Select>
47+
</BootstrapInputGroup>
48+
</div>
49+
<div class="col-12">
50+
</div>
4551
</div>
52+
<OtpInput Value="@_value" Type="_otpInputType"></OtpInput>
4653
</DemoBlock>

src/BootstrapBlazor/Components/Input/OtpInput.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
else
1212
{
1313
var charIndex = index;
14-
<input type="@TypeString" maxlength="@MaxLengthString" inputmode="@TypeModeString" class="@ItemClassString" value="@GetValueString(index)" @onchange="e => OnChanged(e.Value!.ToString(), charIndex)" />
14+
<input type="@TypeString" maxlength="@MaxLengthString" inputmode="@TypeModeString" placeholder="@PlaceHolder"
15+
class="@ItemClassString" value="@GetValueString(index)" @onchange="e => OnChanged(e.Value!.ToString(), charIndex)" />
1516
}
1617
}
1718
</div>

src/BootstrapBlazor/Components/Input/OtpInput.razor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public partial class OtpInput
2929
[Parameter]
3030
public OtpInputType Type { get; set; }
3131

32+
/// <summary>
33+
/// Gets or sets the placeholder of the OTP input. Default is null.
34+
/// </summary>
35+
[Parameter]
36+
public string? PlaceHolder { get; set; }
37+
3238
private string? ClassString => CssBuilder.Default("bb-opt-input")
3339
.AddClassFromAttributes(AdditionalAttributes)
3440
.Build();

src/BootstrapBlazor/Components/Input/OtpInput.razor.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@
3030
text-align: center;
3131
}
3232
}
33+
34+
span.bb-opt-item {
35+
color: #b8b8b8;
36+
}
3337
}

0 commit comments

Comments
 (0)