You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
542 B
19 lines
542 B
<ul class="navbar-nav">
|
|
<li class="nav-item">
|
|
<a class="nav-link @GetClass("Home")" href="@Url.Action("Index","Home")">首页</a>
|
|
</li>
|
|
</ul>
|
|
@functions{
|
|
public string GetClass(params string[] controllers)
|
|
{
|
|
if (controllers.Select(o => o.ToLower()).Contains(this.ViewContext.RouteData.Values["controller"].ToString().ToLower()))
|
|
{
|
|
if (controllers.Length > 1)
|
|
{
|
|
return "active open";
|
|
}
|
|
return "active";
|
|
}
|
|
return "";
|
|
}
|
|
} |