我正在使用选项卡式屏幕布局,其中选项卡模块具有自己的路由来托管选项卡页面及其子页面。这是路线对象:
const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
path: 'home',
children: [
{
path: '',
loadChildren: '../pages/home/home.module#HomePageModule'
}
]
},
{
path: 'deliverablesIndex',
children: [
{
path: '',
loadChildren: '../pages/deliverables-index/deliverables-index.module#DeliverablesIndexPageModule'
},
{
path: 'create',
children: [
{
path: '',
loadChildren: '../pages/deliverable-create/deliverable-create.module#DeliverableCreatePageModule'
}
]
}
]
},
{
path: 'profile',
children: [
{
path: '',
loadChildren: '../pages/profile/profile.module#ProfilePageModule'
}
]
},
{
path: '',
redirectTo: 'tabs/home',
pathMatch: 'full'
}
]
},
{
path: '',
redirectTo: 'tabs/home',
pathMatch: 'full'
}
];
这对于在选项卡之间导航非常有用,但是当我尝试在deliverablesIndex
到create
子路由中更深的页面时,出现此错误:
Cannot match any routes. URL Segment: '/tabs/deliverablesIndex/create'
使用此代码: this.router.navigate(['/ tabs / deliverablesIndex / create /']);
我尝试'/tabs/deliverablesIndex/create/'
和'tabs/deliverablesIndex/create/'
无济于事。
当我自己在浏览器中输入URL时,它会起作用:http://localhost:8100/core/tabs/deliverablesIndex/create
。
我在这里想念什么?