diff --git a/src/BootstrapBlazor/Components/Button/ButtonBase.cs b/src/BootstrapBlazor/Components/Button/ButtonBase.cs index a854bdb69c6..a7aa5c21fb3 100644 --- a/src/BootstrapBlazor/Components/Button/ButtonBase.cs +++ b/src/BootstrapBlazor/Components/Button/ButtonBase.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone +using Microsoft.AspNetCore.Components.Web; + namespace BootstrapBlazor.Components; /// @@ -63,7 +65,7 @@ public abstract class ButtonBase : TooltipWrapperBase /// Gets or sets the OnClick event /// [Parameter] - public EventCallback OnClick { get; set; } + public EventCallback OnClick { get; set; } /// /// 获得/设置 OnClick 事件不刷新父组件 @@ -334,7 +336,7 @@ protected override async ValueTask DisposeAsync(bool disposing) { if (OnClick.HasDelegate) { - OnClick = EventCallback.Empty; + OnClick = EventCallback.Empty; } if (IsAsync && ValidateForm != null) diff --git a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs index d07a803386f..44e93186817 100644 --- a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs +++ b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs @@ -577,6 +577,16 @@ internal void RegisterAsyncSubmitButton(ButtonBase button) AsyncSubmitButtons.Add(button); } + /// + /// 注销提交按钮 + /// Unregisters a submit button + /// + /// + internal void UnregisterAsyncSubmitButton(ButtonBase button) + { + AsyncSubmitButtons.Remove(button); + } + private TaskCompletionSource? _tcs; private async Task OnValidSubmitForm(EditContext context)