ASP.NET Core + Angular
在sidebar-nav.component.ts中修改如下:
// new MenuItem(this.l("HomePage"), "", "home", "/app/home"),
new MenuItem(this.l("HomePage"), "", "fa fa-home", "/app/home"),
在sidebar-nav.component.html中修改如下:
<!-- <i *ngIf="menuItem.icon" class="material-icons">{{menuItem.icon}}</I> -->
<i *ngIf="menuItem.icon && menuItem.icon.startsWith('fa ')" class="{{menuItem.icon}}"></i>
<i *ngIf="menuItem.icon && !menuItem.icon.startsWith('fa ')" class="material-icons">{{menuItem.icon}}</I>
您可能想在 sidebar-nav.component.html 中添加一些样式(见下文)。
ASP.NET Core + jQuery
在*NavigationProvider.cs中修改以下内容:
new MenuItemDefinition(
PageNames.Home,
L("HomePage"),
url: "",
// icon: "home",
icon: "fa fa-home",
requiresAuthentication: true
)
在SideBarNav/Default.cshtml中修改如下:
@if (!string.IsNullOrWhiteSpace(menuItem.Icon))
{
<!-- <i class="material-icons">@menuItem.Icon</i> -->
@if (menuItem.Icon.StartsWith("fa "))
{
<i class="@menuItem.Icon"></i>
}
else
{
<i class="material-icons">@menuItem.Icon</i>
}
}
您可能想在 SideBarNav/Default.cshtml 中添加一些样式(见下文)。
造型
<style>
.sidebar .fa {
font-size: 24px;
height: 30px;
margin-top: 4px;
text-align: center;
width: 24px;
}
</style>