From cc3af1218ce449bb5aa5527e196ab28404e76263 Mon Sep 17 00:00:00 2001 From: Argo-Cloud Date: Fri, 22 Jan 2021 22:26:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=8B=B1=E6=96=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Components/LgbTableHeader.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs b/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs index e8592417..45280b81 100644 --- a/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs +++ b/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; +using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -62,8 +63,17 @@ namespace Bootstrap.Admin.Pages.Components /// public string GetDisplayName() { + var ret = ""; if (_fieldIdentifier == null) _fieldIdentifier = FieldIdentifier.Create(ValueExpression); - return _fieldIdentifier?.GetDisplayName() ?? ""; + if (DisplayNamesExtensions.TryGetValue((_fieldIdentifier.Value.Model.GetType(), _fieldIdentifier.Value.FieldName), out var s)) + { + ret = s; + } + if (string.IsNullOrEmpty(ret)) + { + ret = _fieldIdentifier?.GetDisplayName() ?? ""; + } + return ret; } ///