!799 fix(#I2AMFD): IsOpen value not update when enable IsBackdrop

* fix: fix IsOpen value not right when click container
This commit is contained in:
Argo 2020-12-24 00:13:46 +08:00
parent b1f19f2531
commit 03a5c22cda

View File

@ -73,7 +73,7 @@ namespace BootstrapBlazor.Components
/// 获得/设置 点击背景遮罩时回调委托方法
/// </summary>
[Parameter]
public Action? OnClickBackdrop { get; set; }
public Func<Task>? OnClickBackdrop { get; set; }
/// <summary>
/// 获得/设置 点击遮罩是否关闭抽屉
@ -111,12 +111,13 @@ namespace BootstrapBlazor.Components
/// <summary>
/// 点击背景遮罩方法
/// </summary>
public void OnContainerClick()
public async Task OnContainerClick()
{
if (IsBackdrop)
{
IsOpen = false;
OnClickBackdrop?.Invoke();
if (IsOpenChanged.HasDelegate) await IsOpenChanged.InvokeAsync(IsOpen);
if (OnClickBackdrop != null) await OnClickBackdrop.Invoke();
}
}
}