ant-design-blazor/site/AntDesign.Docs/Shared/PrevNextNav.razor
2021-02-06 20:15:46 +08:00

53 lines
1.3 KiB
C#

<section class="prev-next-nav">
@if (prev != null)
{
<NavLink class="prev-page" href="@($"{MainLayout?.CurrentLanguage}/{prev.Url}")">
<Icon Type="left" Class="footer-nav-icon-before"/>
<span>
@prev.Title
</span>
@if (prev.SubTitle != null)
{
<span class="chinese">@prev.SubTitle</span>
}
<Icon Type="right" Class="footer-nav-icon-after"/>
</NavLink>
}
@if (next != null)
{
<NavLink class="next-page" href="@($"{MainLayout?.CurrentLanguage}/{next.Url}")">
<Icon Type="left" Class="footer-nav-icon-before"/>
<span>@next.Title</span>
@if (next.SubTitle != null)
{
<span class="chinese">@next.SubTitle</span>
}
<Icon Type="right" Class="footer-nav-icon-after"/>
</NavLink>
}
</section>
@code
{
[CascadingParameter]
public MainLayout MainLayout { get; set; }
DemoMenuItem prev;
DemoMenuItem next;
protected override void OnInitialized()
{
base.OnInitialized();
MainLayout.PrevNextNav = this;
}
public void SetPrevNextNav(DemoMenuItem prev, DemoMenuItem next)
{
this.prev = prev;
this.next = next;
StateHasChanged();
}
}