ant-design-blazor/components/back-top/AntBackTop.razor.cs

39 lines
1.1 KiB
C#
Raw Normal View History

2020-04-24 18:32:50 +08:00
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using System.Threading.Tasks;
namespace AntDesign
{
public partial class AntBackTop : AntDomComponentBase
{
[Parameter]
public string Title { get; set; }
protected ClassMapper BackTopClassMapper { get; set; } = new ClassMapper();
protected ClassMapper BackTopContentClassMapper { get; set; } = new ClassMapper();
protected ClassMapper BackTopIconClassMapper { get; set; } = new ClassMapper();
2020-04-24 18:32:50 +08:00
protected async Task OnClick()
{
await JsInvokeAsync(JSInteropConstants.backTop, "BodyContainer");
}
protected override void OnInitialized()
{
SetClass();
base.OnInitialized();
}
protected void SetClass()
{
string prefixCls = "ant-back-top";
BackTopClassMapper.Add(prefixCls);
BackTopContentClassMapper.Add($"{prefixCls}-content");
BackTopIconClassMapper.Add($"{prefixCls}-icon");
}
}
}