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