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

53 lines
1.2 KiB
C#
Raw Normal View History

@namespace AntDesign
@inherits AntInputComponentBase<bool>
<button type="button" role="switch"
aria-checked="@(_isChecked?"true":"false")"
disabled="@Disabled"
class="@ClassMapper.Class"
style="@Style"
ant-click-animating="@(_clickAnimating?"true":"false")"
@onmouseover="HandleMouseOver"
@onmouseout="HandleMouseOut"
@onclick="HandleClick">
@if (Loading)
{
<Icon Type="loading" Class="@($"{_prefixCls}-loading-icon")" />
}
<div class="@($"{_prefixCls}-handle")"></div>
<span class="@($"{_prefixCls}-inner")">
@if (_isChecked)
{
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 (_isChecked)
{
<div class="ant-click-animating-node"></div>
}
else
{
<div class="ant-click-animating-node"></div>
}
</button>