ant-design-blazor/components/back-top/BackTop.razor.cs
James Yeung 360fe0d3c0 fix(hosting): server prerendering issue (#583)
* refactor: rename JSInterop constants

* docs: fix typo

* fix: server prerendering issue
2020-09-09 00:52:14 +08:00

40 lines
1.1 KiB
C#

using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
public partial class BackTop : 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();
protected async Task OnClick()
{
await JsInvokeAsync<DomRect>(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");
}
}
}