From 6402b56db1bdad23b40a9a1ec27b348832f59365 Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 12 Oct 2022 17:30:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20DateTimePicker=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor | 4 ++-- .../Components/DateTimePicker/DateTimePicker.razor | 5 ++--- .../Components/DateTimePicker/DateTimePicker.razor.cs | 7 +++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor b/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor index ab80e29b7..dbf94a519 100644 --- a/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor +++ b/src/BootstrapBlazor.Shared/Samples/DateTimePickers.razor @@ -6,7 +6,7 @@
- +
@@ -140,7 +140,7 @@
+ AutoClose="false" />
diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor index 41b47f4ad..314546443 100644 --- a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor +++ b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor @@ -6,8 +6,8 @@ { } -
- +
+
- diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs index 8d1a12289..29a9b5503 100644 --- a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs +++ b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs @@ -9,6 +9,7 @@ namespace BootstrapBlazor.Components; /// /// DateTimePicker 组件基类 /// +[JSModuleAutoLoader("dropdown", ModuleName = "Dropdown")] public sealed partial class DateTimePicker { /// @@ -43,6 +44,8 @@ public sealed partial class DateTimePicker private string? TabIndexString => ValidateForm != null ? "0" : null; + private string? AutoCloseString => AutoClose ? "true" : null; + /// /// 获得 Placeholder 显示字符串 /// @@ -247,9 +250,9 @@ public sealed partial class DateTimePicker { await OnDateTimeChanged(Value); } - if (AutoClose) + if (AutoClose && Module != null) { - await JSRuntime.InvokeVoidByIdAsync(identifier: "bb.Dropdown.invoke", Id, "hide"); + await Module.InvokeVoidAsync($"{ModuleName}.execute", Id, "hide"); } } } -- Gitee