ant-design-blazor/components/page-header/PageHeader.razor.cs
TimChen cbc5e823f0 refactor(module: all): separate the normal and template parameters (#552)
* fix: card title template

* fix: template:badge,collapse

* fix: comment refactor template

* fix: ribbonTests

* feat: descriptions refactor template

* feat: empty refactor template

* feat: list refactor template

* feat: menu refactor template

* feat: confirm add question icon

* feat: pageHeader and statistic refactor template

* feat: popconfirm refactor template

* feat: popver refactor template

* feat: result refactor template

* feat: step refactor template

* feat: switch refactor template

* feat: table refactor template

* feat: transfer refactor template

* feat: optimized code

* fix: pageheader

* refactor(module: empty): remove empty image constant images

Co-authored-by: ElderJames <shunjiey@hotmail.com>
2020-09-16 13:58:16 +08:00

88 lines
2.2 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using OneOf;
namespace AntDesign
{
public partial class PageHeader
{
#region Parameters
[Parameter]
public bool Ghost { get; set; }
[Parameter]
public OneOf<bool?, string> BackIcon { get; set; }
[Parameter]
public RenderFragment BackIconTemplate { get; set; }
[Parameter]
public string Title { get; set; }
[Parameter]
public RenderFragment TitleTemplate { get; set; }
[Parameter]
public string Subtitle { get; set; }
[Parameter]
public RenderFragment SubtitleTemplate { get; set; }
[Parameter]
public EventCallback OnBack { get; set; }
[Parameter]
public RenderFragment PageHeaderContent { get; set; }
[Parameter]
public RenderFragment PageHeaderFooter { get; set; }
[Parameter]
public RenderFragment PageHeaderBreadcrumb { get; set; }
[Parameter]
public RenderFragment PageHeaderAvatar { get; set; }
[Parameter]
public RenderFragment PageHeaderTitle { get; set; }
[Parameter]
public RenderFragment PageHeaderSubtitle { get; set; }
[Parameter]
public RenderFragment PageHeaderTags { get; set; }
[Parameter]
public RenderFragment PageHeaderExtra { get; set; }
#endregion Parameters
private void SetClassMap()
{
ClassMapper.Clear().Add("ant-page-header")
.If("has-footer", () => PageHeaderFooter != null)
.If("ant-page-header-ghost", () => this.Ghost)
.If("has-breadcrumb", () => PageHeaderBreadcrumb != null);
}
protected override void OnInitialized()
{
base.OnInitialized();
SetClassMap();
}
private async void OnBackClick(MouseEventArgs eventArgs)
{
if (OnBack.HasDelegate)
{
await OnBack.InvokeAsync(eventArgs);
}
else
{
await JsInvokeAsync("history.back");
}
}
}
}