ant-design-blazor/components/switch/Switch.razor

54 lines
1.3 KiB
C#
Raw Normal View History

@namespace AntDesign
@inherits AntInputComponentBase<bool>
<button type="button" role="switch"
aria-checked="@(CurrentValue?"true":"false")"
disabled="@(Disabled||Loading)"
class="@ClassMapper.Class"
style="@Style"
ant-click-animating="@(_clickAnimating?"true":"false")"
@onmouseover="HandleMouseOver"
@onmouseout="HandleMouseOut"
@onclick="HandleClick">
<div class="@($"{_prefixCls}-handle")">
@if (Loading)
{
<Icon Type="loading" Class="@($"{_prefixCls}-loading-icon")" />
}
</div>
<span class="@($"{_prefixCls}-inner")">
@if (CurrentValue)
{
if (CheckedChildren.IsT0)
{
@(CheckedChildren.AsT0)
}
else
{
@(CheckedChildren.AsT1)
}
}
else
{
if (UnCheckedChildren.IsT0)
{
@(UnCheckedChildren.AsT0)
}
else
{
@(UnCheckedChildren.AsT1)
}
2020-03-12 18:23:00 +08:00
}
</span>
2020-03-12 18:23:00 +08:00
<!--animation-->
@if (CurrentValue)
{
<div class="ant-click-animating-node"></div>
}
else
{
<div class="ant-click-animating-node"></div>
}
</button>