{
path: '/home',
component: () => import('../views/home/home.vue'),
children: [
{
path: '',
name: 'home',
component: () => import('../views/home/home.vue'),
},
{
path: 'sub',
name: 'homeSub',
component: () => import('../views/home/subpage.vue')
}
]
},
问题描述:
在项目中使用路由父子是嵌套时,路由不显示页面问题,
解决方法:
1、在父路由得对象里里写入
component: {render: (e) => e("router-view")},
2、父页面的在vue页面中加入
<router-view />
路由代码:
{
path: '/home',
component: {render: (e) => e("router-view")},
children: [
{
path: '',
name: 'home',
component: () => import('../views/home/home.vue'),
},
{
path: 'sub',
name: 'homeSub',
component: () => import('../views/home/subpage.vue')
}
]
},
3、完美解决,撒花❀❀❀❀❀