发现了children中的path不能带 /
改前
{
path: '/root',
name: 'rootViews',
component: rootViews,
children: [
{
path: '/drugs',
name: '药物管理',
component: drugs,
children: [
{
path: '/main',
name: '药品信息',
component: drugs,
}, {
path: '/type',
name: '药品类型信息',
component: rootViews,
}, {
path: '/unit',
name: '药品规格单位信息',
component: rootViews,
}
]
},
改后之后
{
path: '/root',
name: 'rootViews',
component: rootViews,
children: [
{
path: 'drugs',
name: '药物管理',
component: drugs,
children: [
{
path: 'main',
name: '药品信息',
component: drugs,
}, {
path: 'type',
name: '药品类型信息',
component: rootViews,
}, {
path: 'unit',
name: '药品规格单位信息',
component: rootViews,
}
]
}
本文介绍了一个关于前端路由配置的问题,即在定义子路由时路径中不应包含斜杠('/')。通过对比修改前后的路由配置代码,展示了正确的子路由设置方法。
5265

被折叠的 条评论
为什么被折叠?



