一、在子路由前面加上父路由路径
{
path: "/foundMusic",
component: FoundMusic,
children: [
{ path: "/foundMusic/newdisc", component: NewDisc },
{ path: "/foundMusic/radio", component: Radio },
{ path: "/foundMusic/rank", component: Rank },
{ path: "/foundMusic/recommend", component: Recommend },
{ path: "/foundMusic/singer", component: Singer },
{ path: "/foundMusic/songs", component: Songs },
] }
二、使用.router-link-active代替.router-link-exact-active。
.router-link-active {
background: black;
&::after {
content: ‘‘;
display: block;
position: absolute;
bottom: 0;
left: 50%;
border-width: 5px;
border-color: transparent transparent red transparent;
border-style: solid; //利用伪类使选中路由添加红色三角样式
}
}
原文:https://www.cnblogs.com/jeromeNie/p/10917426.html