Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ContextMenu): Add OnClickBefore callback event #4112

Merged
merged 16 commits into from
Aug 22, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
[Parameter]
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// 获得/设置 弹出前回调方法 默认 null
/// </summary>
[Parameter]
public Func<object?, Task>? OnClickBefore { get; set; }

/// <summary>
/// 获得/设置 上下文菜单组件集合
/// </summary>
Expand All @@ -37,6 +43,10 @@
// 弹出关联菜单
if (ContextMenu != null)
{
if (OnClickBefore is not null)
{
await OnClickBefore(contextItem);
}

Check warning on line 49 in src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs#L47-L49

Added lines #L47 - L49 were not covered by tests
await ContextMenu.Show(args, contextItem);
}
}
Expand Down