From e361ffb365d9c70b67d87163284477a992f0ddae Mon Sep 17 00:00:00 2001 From: Argo Date: Sun, 27 Dec 2020 01:29:05 +0800 Subject: [PATCH] =?UTF-8?q?!819=20feat(#I2AYEQ):=20add=20Match=20property?= =?UTF-8?q?=20on=20MenuItem=20*=20feat:=20MenuItem=20=E5=A2=9E=E5=8A=A0=20?= =?UTF-8?q?Match=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Menu/MenuItem.cs | 6 ++++++ src/BootstrapBlazor/Components/Menu/MenuLink.razor | 2 +- src/BootstrapBlazor/Components/Menu/MenuLink.razor.cs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Menu/MenuItem.cs b/src/BootstrapBlazor/Components/Menu/MenuItem.cs index 45980202f..9f598d4b8 100644 --- a/src/BootstrapBlazor/Components/Menu/MenuItem.cs +++ b/src/BootstrapBlazor/Components/Menu/MenuItem.cs @@ -7,6 +7,7 @@ // 开源协议:Apache-2.0 (https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/dev/LICENSE) // ********************************** +using Microsoft.AspNetCore.Components.Routing; using System.Collections.Generic; using System.Linq; @@ -63,6 +64,11 @@ namespace BootstrapBlazor.Components /// public string? Icon { get; set; } + /// + /// 获得/设置 匹配方式 默认 NavLinkMatch.Prefix + /// + public NavLinkMatch Match { get; set; } + /// /// 获得/设置 菜单内子组件 /// diff --git a/src/BootstrapBlazor/Components/Menu/MenuLink.razor b/src/BootstrapBlazor/Components/Menu/MenuLink.razor index afad8335f..6c4a58ba9 100644 --- a/src/BootstrapBlazor/Components/Menu/MenuLink.razor +++ b/src/BootstrapBlazor/Components/Menu/MenuLink.razor @@ -1,7 +1,7 @@ @namespace BootstrapBlazor.Components @inherits BootstrapComponentBase - + @if (!string.IsNullOrEmpty(Item.Icon)) { diff --git a/src/BootstrapBlazor/Components/Menu/MenuLink.razor.cs b/src/BootstrapBlazor/Components/Menu/MenuLink.razor.cs index 2817a1708..d3bd5c827 100644 --- a/src/BootstrapBlazor/Components/Menu/MenuLink.razor.cs +++ b/src/BootstrapBlazor/Components/Menu/MenuLink.razor.cs @@ -53,6 +53,6 @@ namespace BootstrapBlazor.Components 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; } }