Upgrade Nuget
大石头 authored at 2024-11-20 14:22:34
2.56 KiB
YuQue
@using NewLife.Common;
@using NewLife.YuqueWeb.Entity
@{
    var header = Nav.Root.FindByPath("头部") ?? Nav.Root;
}
<nav class="navbar navbar-inverse navbar-static-top bs-docs-nav">
@* <nav class="navbar navbar-inverse navbar-fixed-top"> *@
    <div class="container">
        <div class="navbar-header">
            <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false">
                <span class="sr-only">导航菜单</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="./">@SysConfig.Current.DisplayName</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                @foreach (var nav in header.Childs)
                {
                    if (nav.Childs.Count == 0)
                    {
                        if (nav.NewWindow)
                        {
                            <li role="presentation"><a href="@nav.Url" class="active" target="_blank">@nav.Name</a></li>
                        }
                        else
                        {
                            <li role="presentation"><a href="@nav.Url" class="active">@nav.Name</a></li>
                        }
                    }
                    else
                    {
                        <li role="presentation" class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">@nav.Name<span class="caret"></span></a>
                            <ul class="dropdown-menu" role="menu">
                                @foreach (var item in nav.Childs)
                                {
                                    if (item.NewWindow)
                                    {
                                        <li><a href="@item.Url" class="" target="_blank">@item.Name</a></li>
                                    }
                                    else
                                    {
                                        <li><a href="@item.Url" class="">@item.Name</a></li>
                                    }
                                }
                            </ul>
                        </li>
                    }
                }
                <li role="presentation"><a href="/Admin" target="_blank">管理后台</a></li>
            </ul>
        </div>
    </div>
</nav>