mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-05 05:29:47 +08:00
!819 feat(#I2AYEQ): add Match property on MenuItem
* feat: MenuItem 增加 Match 属性
This commit is contained in:
parent
1d12fa8a7d
commit
e361ffb365
@ -7,6 +7,7 @@
|
|||||||
// 开源协议:Apache-2.0 (https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/dev/LICENSE)
|
// 开源协议:Apache-2.0 (https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/dev/LICENSE)
|
||||||
// **********************************
|
// **********************************
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components.Routing;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -63,6 +64,11 @@ namespace BootstrapBlazor.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Icon { get; set; }
|
public string? Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得/设置 匹配方式 默认 NavLinkMatch.Prefix
|
||||||
|
/// </summary>
|
||||||
|
public NavLinkMatch Match { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 菜单内子组件
|
/// 获得/设置 菜单内子组件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@namespace BootstrapBlazor.Components
|
@namespace BootstrapBlazor.Components
|
||||||
@inherits BootstrapComponentBase
|
@inherits BootstrapComponentBase
|
||||||
|
|
||||||
<NavLink @attributes="@AdditionalAttributes" class="@ClassString" href="@GetHrefString" @onclick="@OnClickLink" Match="@GetMatch()" data-match="@GetMatch()">
|
<NavLink @attributes="@AdditionalAttributes" class="@ClassString" href="@GetHrefString" @onclick="@OnClickLink" Match="@GetMatch()">
|
||||||
@if (!string.IsNullOrEmpty(Item.Icon))
|
@if (!string.IsNullOrEmpty(Item.Icon))
|
||||||
{
|
{
|
||||||
<i class="@Item.Icon"></i>
|
<i class="@Item.Icon"></i>
|
||||||
|
@ -53,6 +53,6 @@ namespace BootstrapBlazor.Components
|
|||||||
if (OnClick != null) await OnClick(Item);
|
if (OnClick != null) await OnClick(Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NavLinkMatch GetMatch() => string.IsNullOrEmpty(Item.Url) ? NavLinkMatch.All : NavLinkMatch.Prefix;
|
private NavLinkMatch GetMatch() => string.IsNullOrEmpty(Item.Url) ? NavLinkMatch.All : Item.Match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user