搜索
您的当前位置:首页正文

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

来源:爱go旅游网

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

{

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

因篇幅问题不能全部显示,请点此查看更多更全内容

Top