mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-04 04:58:05 +08:00
65 lines
1.5 KiB
C#
65 lines
1.5 KiB
C#
@namespace AntDesign
|
|
@inherits AntDomComponentBase
|
|
|
|
<CascadingValue Value="this" IsFixed>
|
|
@if (ShowTooltip)
|
|
{
|
|
<Tooltip TitleTemplate="@content(this)" Placement="@Placement.Right" Disabled="TooltipDisabled">
|
|
<Unbound Context="tooltip">
|
|
@MenuItemContent(tooltip.Current)
|
|
</Unbound>
|
|
</Tooltip>
|
|
}
|
|
else
|
|
{
|
|
@MenuItemContent(Ref)
|
|
}
|
|
</CascadingValue>
|
|
|
|
@code {
|
|
|
|
RenderFragment MenuItemContent(ElementReference reference)
|
|
{
|
|
return @<li class="@ClassMapper.Class" role="menuitem" style="@PaddingStyle @Style" @onclick="HandleOnClick" @key="Key" @ref="reference">
|
|
@icon(this)
|
|
<span class="ant-menu-title-content">
|
|
@if (RouterLink == null)
|
|
{
|
|
@content(this)
|
|
}
|
|
else
|
|
{
|
|
<MenuLink Href="@RouterLink" Match="@RouterMatch">@content(this)</MenuLink>
|
|
}
|
|
</span>
|
|
</li>;
|
|
}
|
|
|
|
RenderFragment<MenuItem> content = item =>
|
|
@<Template>
|
|
@if (item.Title != null)
|
|
{
|
|
@item.Title
|
|
}
|
|
else
|
|
{
|
|
@item.ChildContent
|
|
}
|
|
</Template>
|
|
;
|
|
|
|
RenderFragment<MenuItem> icon = item =>
|
|
@<Template>
|
|
@if (item.IconTemplate != null)
|
|
{
|
|
<span role="img" class=" anticon anticon-container">
|
|
@item.IconTemplate
|
|
</span>
|
|
}
|
|
else if (item.Icon != null)
|
|
{
|
|
<Icon Type="@item.Icon" />
|
|
}
|
|
</Template>
|
|
;
|
|
} |