我正在使用此代码进行路由
{ path: 'dashboard', loadChildren: './dashboard#DashboardModule'},
{ path: '', children: [
{ path: '', component:DashboardComponent, children: [
{ path: '', redirectTo:'dashboard/first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent }]
},
]},
在这里,当URL是/dashboard
我需要它路由到/dashboard/first...
我该如何实现?
您已经在Dashboard
组件中。仅使用first
,不使用dashboard/first
。
{ path: '', children: [
{ path: '', component:DashboardComponent ,
children:[
{ path: '', redirectTo:'first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent },
]
},
]},
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句