路由: 新闻页下面嵌套着一个新闻详情页
{
path: '/news',
name: 'news',
component: news,
meta: {
title: '最新资讯'
},
children: [ //这里就是二级路由的配置
{
path: '/news/newsDetail',
name: 'newsDetail',
component: newsDetail,
meta: {
title: '9最新资讯详情'
}
}
]
},
组件的内容
<router-link class="item" :to="{path:'/news/newsDetail'}" v-for='(item, index) in news.con' :key='index'>
</router-link>
<router-view></router-view>
因为我想实现新闻详情页的导航有高亮效果,现在可以进入详情页,发现详情页内页包含着列表页的内容
路由:新闻列表和详情变成同级
列表页:
最后再导航链接上去掉exact属性,之前没有去掉,导致页面进入新闻详情导航不高亮。
最后真的很谢谢你们啊,感谢你们的奉献给我前进的动力。
(2019.3.5)回答 沁冷月 的问题: