我正在尝试使用以下代码为我的菜单栏应用或突出显示导航路线,我能得到的是,我可以突出显示子菜单,但无法突出显示父菜单栏。
<li class="nav-item dropdown"><a
class="nav-link dropdown-toggle " id="navbarDropdownMenuLink"
data-toggle="dropdown" style="color: white; cursor: pointer;"
[routerLinkActive]="['class1']">Parent</a>
<div class="dropdown-menu dropdown-menu-left"
aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item"
[routerLink]="['app-child1']"
[routerLinkActive]="['class1']"
>Child 1</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item"
[routerLink]="['app-child2']"
[routerLinkActive]="['class1']"
>Child 2</a>
</div>
</li>
CSS类:
.class1{
background-color: #007bff;
}