vue子路由选中后父路由样式消失解决办法


一、在子路由前面加上父路由路径

{

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; //利用伪类使选中路由添加红色三角样式

}

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM