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