我是Vue JS的新手,有人告诉我,可以使用映射路由。我的情况:我有一个包含子菜单的菜单。有人告诉我,如果应用程序的样式保持不变,那么我可以在所有菜单/子菜单中仅使用1个组件。唯一需要更改的内容是,每次您单击菜单项时,都需要更改菜单项图标,并且路线网址将指向下一个子菜单。
我找不到有关映射路由的任何好的信息。但是发现了有关子路线的一些信息。
// Nested Config
{
path: '/my-route',
component: EmptyRouterView,
children: [{
name: 'route',
path: '',
component: MyRouteView
}, {
name: 'route.child-one'
path: 'child-one',
component: ChildOneView
}, {
name: 'route.child-two'
path: 'child-two',
component: ChildTwoView
}]
}
我希望所有菜单只有一个组件。因此,基本上每次您从菜单切换时,菜单名称/图标和路线都需要更改(基本上只是组件数据)。