vue router children 不正常显示问题
{path: '/home',component: () => import('../views/home/home.vue'),children: [{path: '',name: 'home',component: () => import('../views/home/home.vue'),},{path: 'sub',name.
·
{
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、完美解决,撒花❀❀❀❀❀
更多推荐
已为社区贡献8条内容
所有评论(0)