From 417d11e54c548ac95f4af95dbc8e4d74948870dc Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Sat, 31 Jul 2021 10:00:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E5=A4=96?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=97=B6=E7=82=B9=E5=87=BB=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=90=8E=E4=BB=8D=E7=84=B6=E6=94=B9=E5=8F=98=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/DateTimePicker/DatePickerBody.razor.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs index b1f40babf..ef7bacc63 100644 --- a/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs +++ b/src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs @@ -566,8 +566,9 @@ namespace BootstrapBlazor.Components private async Task ClickConfirmButton() { ShowTimePicker = false; - if (ValueChanged.HasDelegate) + if (Validate() && ValueChanged.HasDelegate) { + await ValueChanged.InvokeAsync(Value); } if (OnConfirm != null) @@ -576,6 +577,8 @@ namespace BootstrapBlazor.Components } } + private bool Validate() => (!MinValue.HasValue || Value >= MinValue.Value) && (!MaxValue.HasValue || Value <= MaxValue.Value); + /// /// /// -- Gitee