feat: Blazor LgbTableHeader 支持扩展属性
This commit is contained in:
parent
b2b4192d55
commit
364c718cd2
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
||||
namespace Bootstrap.Admin.Pages.Components
|
||||
|
@ -7,6 +8,11 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
/// </summary>
|
||||
public interface ITableHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取绑定字段显示名称方法
|
||||
/// </summary>
|
||||
IReadOnlyDictionary<string, object> AdditionalAttributes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取绑定字段显示名称方法
|
||||
/// </summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Bootstrap.Admin.Pages.Extensions;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Bootstrap.Admin.Pages.Components
|
||||
|
@ -12,6 +12,12 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
public class LgbTableHeader<TItem> : ComponentBase, ITableHeader
|
||||
{
|
||||
#nullable disable
|
||||
/// <summary>
|
||||
/// 获得/设置 数据绑定 Value
|
||||
/// </summary>
|
||||
[Parameter(CaptureUnmatchedValues = true)]
|
||||
public IReadOnlyDictionary<string, object> AdditionalAttributes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 数据绑定 Value
|
||||
/// </summary>
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
var fieldName = header.GetFieldName();
|
||||
var displayName = header.GetDisplayName();
|
||||
builder.OpenElement(index++, "th");
|
||||
builder.AddMultipleAttributes(index++, header.AdditionalAttributes);
|
||||
|
||||
// 如果允许排序
|
||||
if (header.Sort)
|
||||
|
|
Loading…
Reference in New Issue