- {
- path: '/singer',
- name: 'singer',
- component: layout,
- redirect: '/singer/page',
- children: [
- {
- path: 'page',
- name: 'singerPage',
- component: () => import('@/views/singer'),
- children: [{
- path: ':id',
- component: ()=> import('@/components/singerDetail/singer-detail')
- }]
- }
- ]
- }
嵌套路由的时候子路由写在 childrenvs ,path 中无需添加 /, 添加后会被根路径
---------
如果你的嵌套如上面代码, 你在组件中
- this.$router.push({
- path: '/singer/page/' + e.id
- })
同时在 singer 组件中加上 router-view 渲染组件
来源: http://www.bubuko.com/infodetail-3230886.html