Skip to content

Commit ad3634f

Browse files
committed
feat: 增加秒针控制
1 parent 588655d commit ad3634f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@
172172
<input type="text" autocomplete="off" readonly class="form-control"
173173
value="@CurrentTime.ToString(TimeFormat)"
174174
@onclick="@OnShowTimePicker" />
175-
<TimePicker Value="CurrentTime" OnClose="OnCloseTime" OnConfirm="OnConfirmTime"></TimePicker>
175+
<TimePicker Value="CurrentTime" HasSeconds="HasSeconds()"
176+
ShowRequired="false" ShowLabel="false" SkipValidate="true"
177+
OnClose="OnCloseTime" OnConfirm="OnConfirmTime"></TimePicker>
176178
</div>
177179
}
178180
@if (ShowFooter)

src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,16 @@ private void OnShowTimePicker()
734734
StateHasChanged();
735735
}
736736

737+
private bool HasSeconds()
738+
{
739+
if (TimeFormat != null)
740+
{
741+
return TimeFormat.Contains('s');
742+
}
743+
744+
return TimePickerOption.ShowSecond;
745+
}
746+
737747
private bool ShouldConfirm => !IsDateTimeMode && (AutoClose || ShowFooter == false);
738748

739749
/// <summary>

0 commit comments

Comments
 (0)