Skip to content

Commit 208d440

Browse files
refactor(Layout): improve context menu instance (#5768)
* 更新demo * refactor: 重构右键区域菜单 * test: 更新单元测试 * refactor: 优化性能 * refactor: 重构参数减少级联参数的使用 * refactor: 增加可为空标签减少警告信息 * refactor: 模块化 * refactor: 使用私有变量 * refactor: 重构参数减少级联参数的使用 * refactor: 减少级联参数 * refactor: 使用代码完成渲染 * refactor: 调整 fix 元素 * refactor: 增加右键支持 * refactor: 更新渲染逻辑 * refactor: 更新样式 * refactor: 更新 LayoutId 获得逻辑 * refactor: 撤销样式 * Revert "更新demo" This reverts commit 860640a. # Conflicts: # src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs --------- Co-authored-by: Diego <[email protected]>
1 parent b0c29a6 commit 208d440

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ public partial class ContextMenuZone
1818
[Parameter]
1919
public RenderFragment? ChildContent { get; set; }
2020

21-
/// <summary>
22-
/// 获得/设置 上下文菜单组件集合
23-
/// </summary>
24-
private ContextMenu? ContextMenu { get; set; }
21+
private ContextMenu? _contextMenu;
2522

2623
private string? ClassString => CssBuilder.Default("bb-cm-zone")
2724
.AddClassFromAttributes(AdditionalAttributes)
@@ -36,15 +33,15 @@ public partial class ContextMenuZone
3633
internal async Task OnContextMenu(MouseEventArgs args, object? contextItem)
3734
{
3835
// 弹出关联菜单
39-
if (ContextMenu != null)
36+
if (_contextMenu != null)
4037
{
41-
await ContextMenu.Show(args, contextItem);
38+
await _contextMenu.Show(args, contextItem);
4239
}
4340
}
4441

4542
/// <summary>
4643
/// ContextMenu 组件调用
4744
/// </summary>
4845
/// <param name="contextMenu"></param>
49-
internal void RegisterContextMenu(ContextMenu contextMenu) => ContextMenu = contextMenu;
46+
internal void RegisterContextMenu(ContextMenu contextMenu) => _contextMenu = contextMenu;
5047
}

0 commit comments

Comments
 (0)