ant-design-blazor / blazor-pro-components

Pro Components of Blazor. 🏆 Use Ant Design like a Pro!
Apache License 2.0
146 stars 43 forks source link

Can BaseMenu add IconFont support? #74

Closed ysj265 closed 10 months ago

ysj265 commented 1 year ago
static readonly RenderFragment<MenuDataItem> title= menuItem => @<span>
                                                                    @if (!string.IsNullOrEmpty(menuItem.Icon))
                                                                    {
                                                                        <Icon Type="@menuItem.Icon" Theme="outline"  />
                                                                    }
                                                                   @if (!string.IsNullOrEmpty(menuItem.IconFont))
                                                                    {
                                                                        <IconFont Type="@menuItem.IconFont" />
                                                                    }

public class MenuDataItem
{
    public string[] Authority { get; set; }
    public virtual MenuDataItem[] Children { get; set; }
    public bool HideChildrenInMenu { get; set; }
    public bool HideInMenu { get; set; }
    public string Icon { get; set; }
    public string IconFont { get; set; }  //Add
    public string Locale { get; set; }
    public virtual string Name { get; set; }
    public string Key { get; set; }
    public string Path { get; set; }
    public string[] ParentKeys { get; set; }
    public NavLinkMatch Match { get; set; }
}

}

ElderJames commented 1 year ago

Thanks for contacting us @ysj265 ,please feel free to send a PR

ElderJames commented 10 months ago

Hello @ysj265 ,please update to v0.17.1.2.

new MenuDataItem
{
        TitleTemplate =@<span><Icon Type="user"></Icon> Custom Menu </span>,
 }