From e18a181386d082803137fa4eaf9cc855884898a8 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 28 Sep 2022 14:15:53 +0800 Subject: [PATCH 1/9] =?UTF-8?q?refactor:=20=E7=A7=BB=E5=8A=A8=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E9=AA=8C=E8=AF=81=E8=81=94=E5=8A=A8=E5=88=B0=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Button/Button.razor.cs | 23 ------------------- .../Components/Button/ButtonBase.cs | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/BootstrapBlazor/Components/Button/Button.razor.cs b/src/BootstrapBlazor/Components/Button/Button.razor.cs index 3f855a2e5..2faa488c5 100644 --- a/src/BootstrapBlazor/Components/Button/Button.razor.cs +++ b/src/BootstrapBlazor/Components/Button/Button.razor.cs @@ -22,12 +22,6 @@ public partial class Button /// protected EventCallback OnClickButton { get; set; } - /// - /// 获得 ValidateForm 实例 - /// - [CascadingParameter] - protected ValidateForm? ValidateForm { get; set; } - /// /// 获得/设置 html button 实例 /// @@ -66,12 +60,6 @@ public partial class Button IsAsyncLoading = false; } }); - - if (IsAsync && ValidateForm != null) - { - // 开启异步操作时与 ValidateForm 联动 - ValidateForm.RegisterAsyncSubmitButton(this); - } } /// @@ -117,15 +105,4 @@ public partial class Button await OnClick.InvokeAsync(); } } - - /// - /// 触发按钮异步操作方法 - /// - /// true 时显示正在操作 false 时表示结束 - internal void TriggerAsync(bool loading) - { - IsAsyncLoading = loading; - ButtonIcon = loading ? LoadingIcon : Icon; - SetDisable(loading); - } } diff --git a/src/BootstrapBlazor/Components/Button/ButtonBase.cs b/src/BootstrapBlazor/Components/Button/ButtonBase.cs index 9282bfcda..572d8787d 100644 --- a/src/BootstrapBlazor/Components/Button/ButtonBase.cs +++ b/src/BootstrapBlazor/Components/Button/ButtonBase.cs @@ -153,6 +153,12 @@ public abstract class ButtonBase : IdComponentBase, IAsyncDisposable [Parameter] public string TooltipTrigger { get; set; } = "hover focus"; + /// + /// 获得 ValidateForm 实例 + /// + [CascadingParameter] + protected ValidateForm? ValidateForm { get; set; } + /// /// 获得/设置 是否当前正在异步执行操作 /// @@ -166,6 +172,12 @@ public abstract class ButtonBase : IdComponentBase, IAsyncDisposable base.OnInitialized(); ButtonIcon = Icon; + + if (IsAsync && ValidateForm != null) + { + // 开启异步操作时与 ValidateForm 联动 + ValidateForm.RegisterAsyncSubmitButton(this); + } } /// @@ -223,6 +235,17 @@ public abstract class ButtonBase : IdComponentBase, IAsyncDisposable StateHasChanged(); } + /// + /// 触发按钮异步操作方法 + /// + /// true 时显示正在操作 false 时表示结束 + internal void TriggerAsync(bool loading) + { + IsAsyncLoading = loading; + ButtonIcon = loading ? LoadingIcon : Icon; + SetDisable(loading); + } + /// /// 显示 Tooltip 方法 /// -- Gitee From baa87638ef4ee5364da1f9142cd0ba633e6567a7 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 28 Sep 2022 14:16:06 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E8=81=94?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Button/PopConfirmButton.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor b/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor index 127fbc1a1..6365a8f91 100644 --- a/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor +++ b/src/BootstrapBlazor/Components/Button/PopConfirmButton.razor @@ -4,9 +4,9 @@ - @if (!string.IsNullOrEmpty(Icon)) + @if (!string.IsNullOrEmpty(ButtonIcon)) { - + } @if (!string.IsNullOrEmpty(Text)) { -- Gitee From a6cfecfc75a8131882d3d07356502843b98ac6a6 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 28 Sep 2022 14:16:25 +0800 Subject: [PATCH 3/9] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=8C=89=E9=92=AE=E7=B1=BB=E5=9E=8B=E4=B8=BA=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ValidateForm/ValidateForm.razor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs index 227778b50..8f0d77415 100644 --- a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs +++ b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs @@ -452,13 +452,13 @@ public partial class ValidateForm : IAsyncDisposable private bool _invalid = false; - private List