mirror of https://github.com/abpframework/abp.git
3 changed files with 87 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Components.WebAssembly |
||||
|
{ |
||||
|
public class BreadcrumbItem |
||||
|
{ |
||||
|
public string Text { get; set; } |
||||
|
|
||||
|
public string Icon { get; set; } |
||||
|
|
||||
|
public string Url { get; set; } |
||||
|
|
||||
|
public BreadcrumbItem(string text, string url = null, string icon = null) |
||||
|
{ |
||||
|
Text = text; |
||||
|
Url = url; |
||||
|
Icon = icon; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
<Row Class="entry-row"> |
||||
|
<Column ColumnSize="ColumnSize.IsAuto"> |
||||
|
<h1 class="content-header-title">@Title</h1> |
||||
|
</Column> |
||||
|
@if (BreadcrumbItems.Any()) |
||||
|
{ |
||||
|
<Column ColumnSize="ColumnSize.IsAuto.OnWidescreen" Class="pl-lg-0"> |
||||
|
<Breadcrumb Mode="@(BreadcrumbShowCurrent ? BreadcrumbMode.Auto : BreadcrumbMode.None)"> |
||||
|
@if (BreadcrumbShowHome) |
||||
|
{ |
||||
|
<BreadcrumbItem> |
||||
|
<BreadcrumbLink To="/"><i class="fa fa-home"></i></BreadcrumbLink> |
||||
|
</BreadcrumbItem> |
||||
|
} |
||||
|
@foreach (var item in BreadcrumbItems) |
||||
|
{ |
||||
|
<BreadcrumbItem> |
||||
|
<BreadcrumbLink To="@item.Url"> |
||||
|
@if (!string.IsNullOrEmpty(item.Icon)) |
||||
|
{ |
||||
|
<i class="fa @item.Icon"></i> |
||||
|
} |
||||
|
@item.Text |
||||
|
</BreadcrumbLink> |
||||
|
</BreadcrumbItem> |
||||
|
} |
||||
|
</Breadcrumb> |
||||
|
</Column> |
||||
|
} |
||||
|
<Column> |
||||
|
<div class="text-lg-right pt-2"> |
||||
|
@ChildContent |
||||
|
</div> |
||||
|
</Column> |
||||
|
</Row> |
||||
@ -0,0 +1,34 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using Microsoft.AspNetCore.Components; |
||||
|
using Volo.Abp.AspNetCore.Components.WebAssembly; |
||||
|
|
||||
|
namespace Volo.Abp.BlazoriseUI.Components |
||||
|
{ |
||||
|
public partial class PageHeader : ComponentBase |
||||
|
{ |
||||
|
[Parameter] |
||||
|
public string Title { get; set; } |
||||
|
|
||||
|
[Parameter] |
||||
|
public bool BreadcrumbShowHome { get; set; } = true; |
||||
|
|
||||
|
[Parameter] |
||||
|
public bool BreadcrumbShowCurrent { get; set; } = true; |
||||
|
|
||||
|
[Parameter] |
||||
|
public RenderFragment ChildContent { get; set; } |
||||
|
|
||||
|
protected List<BreadcrumbItem> BreadcrumbItems { get; set; } |
||||
|
|
||||
|
public PageHeader() |
||||
|
{ |
||||
|
BreadcrumbItems = new List<BreadcrumbItem>(); |
||||
|
} |
||||
|
|
||||
|
public void AddBreadcrumbItem(string text, string url = null, string icon = null) |
||||
|
{ |
||||
|
BreadcrumbItems.Add(new BreadcrumbItem(text, url, icon)); |
||||
|
StateHasChanged(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue