mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 09:21:24 +08:00
914421651b
* feat(module: list): add event callback for list items * docs: add onitemclick in doc
59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
@namespace AntDesign
|
|
@inherits AntDomComponentBase
|
|
|
|
@if (Grid == null)
|
|
{
|
|
<li class="@ClassMapper.Class" style="@Style" Id="@Id" @onclick="HandleClick" @onclick:stopPropagation>
|
|
@itemChildren(this)
|
|
</li>
|
|
}
|
|
else
|
|
{
|
|
<AntDesign.Col Flex="1" Style="@ColStyle">
|
|
<div class="@ClassMapper.Class" style="@Style" Id="@Id" @onclick="HandleClick" @onclick:stopPropagation>
|
|
@itemChildren(this)
|
|
</div>
|
|
</AntDesign.Col>
|
|
}
|
|
@code{
|
|
RenderFragment<AntListItem> itemChildren = content =>
|
|
@<Template>
|
|
@if (content.ItemLayout == AntDirectionVHType.Vertical && content.Extra != null)
|
|
{
|
|
<div class="@content.PrefixName-main">
|
|
@content.ChildContent
|
|
@content.actionsContent(content)
|
|
</div>
|
|
<div class="@content.PrefixName-extra">@content.Extra</div>
|
|
}
|
|
else
|
|
{
|
|
@content.ChildContent
|
|
@content.actionsContent(content)
|
|
@if (content.Extra != null)
|
|
{
|
|
@content.Extra
|
|
}
|
|
}
|
|
</Template>;
|
|
|
|
RenderFragment<AntListItem> actionsContent = content =>
|
|
@<Template>
|
|
@if (content.Actions != null && content.Actions.Count > 0)
|
|
{
|
|
<ul class="@content.PrefixName-action" key="actions">
|
|
@for (int i = 0; i < content.Actions.Count; i++)
|
|
{
|
|
<li key="@content.PrefixName-action-@i">
|
|
@content.Actions[i]
|
|
@if (i != (content.Actions.Count - 1))
|
|
{
|
|
<em class="@content.PrefixName-action-split" />
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
</Template>;
|
|
}
|