fix: 修复 Blazor 模式无法打开问题
This commit is contained in:
parent
6a3b006cc1
commit
80f5c1be1f
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using BootstrapBlazor.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
@ -64,14 +65,18 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
public string GetDisplayName()
|
||||
{
|
||||
var ret = "";
|
||||
if (_fieldIdentifier == null) _fieldIdentifier = FieldIdentifier.Create(ValueExpression);
|
||||
if (_fieldIdentifier == null)
|
||||
{
|
||||
_fieldIdentifier = FieldIdentifier.Create(ValueExpression);
|
||||
}
|
||||
|
||||
if (DisplayNamesExtensions.TryGetValue((_fieldIdentifier.Value.Model.GetType(), _fieldIdentifier.Value.FieldName), out var s))
|
||||
{
|
||||
ret = s;
|
||||
}
|
||||
if (string.IsNullOrEmpty(ret))
|
||||
{
|
||||
ret = _fieldIdentifier?.GetDisplayName() ?? "";
|
||||
ret = _fieldIdentifier.HasValue ? FieldIdentifierExtensions.GetDisplayName(_fieldIdentifier.Value) : "";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -81,7 +86,11 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
/// </summary>
|
||||
public string GetFieldName()
|
||||
{
|
||||
if (_fieldIdentifier == null) _fieldIdentifier = FieldIdentifier.Create(ValueExpression);
|
||||
if (_fieldIdentifier == null)
|
||||
{
|
||||
_fieldIdentifier = FieldIdentifier.Create(ValueExpression);
|
||||
}
|
||||
|
||||
return _fieldIdentifier?.FieldName ?? "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using BootstrapBlazor.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace Bootstrap.Admin
|
|||
if (Enviroment.IsDevelopment()) options.DetailedErrors = true;
|
||||
});
|
||||
services.AddDisplayNames();
|
||||
services.AddBootstrapBlazor();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
|
Loading…
Reference in New Issue