Child routes with tabs / router outlets are not working. "Error: Cannot match any routes. URL Segment"

Child routes with tabs / router outlets are not working. "Error: Cannot match any routes. URL Segment"

当我尝试以下操作时:

const routes: Routes = [
  {
    path: "", component: RegisteredLayoutComponent, canActivate: [AuthGuard], children: [
      {
        path: '',
        redirectTo:
          "/(topicsTab:topicsPage//newsTab:newsPage//homeTab:homePage//askTab:askPage//moreTab:morePage)",
        pathMatch: "full"
      },
      { path: 'home', component: HomePageComponent, outlet: "homeTab" },...

{ path: '**', redirectTo: '' }

我得到"Error: Cannot match any routes. URL Segment"

我是不是做错了什么?包含路由器插座的页面如下所示:

<BottomNavigation selectedIndex="2">
    <TabStrip backgroundColor="white">
        <TabStripItem>
            <Label text="Topics" class="icon__color"></Label>
            <Image src="~/assets/round_people_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="News" class="icon__color"></Label>
            <Image src="~/assets/round_local_library_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="Home" class="icon__color"></Label>
            <Image src="~/assets/round_home_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="Ask?" class="icon__color"></Label>
            <Image src="~/assets/round_contact_support_black_18dp.png" class="fas t-36 "></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="More" class="icon__color"></Label>
            <Image src="~/assets/round_more_horiz_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
    </TabStrip>
    <!-- The number of TabContentItem components should corespond to the number of TabStripItem components -->
    <TabContentItem>
        <page-router-outlet name="topicsTab"></page-router-outlet>
    </TabContentItem>
    <TabContentItem>
        <page-router-outlet name="newsTab"></page-router-outlet>
    </TabContentItem>
    <TabContentItem>
        <page-router-outlet name="homeTab"></page-router-outlet>
    </TabContentItem>
    <TabContentItem>
        <page-router-outlet name="askTab"></page-router-outlet>
    </TabContentItem>
    <TabContentItem>
        <page-router-outlet name="moreTab"></page-router-outlet>
    </TabContentItem>
</BottomNavigation>

谁能告诉我重定向的正确方法是什么?

谢谢!!!

我明白了 :-) 真正帮助我找到正确路线的是像这样启用跟踪:

@NgModule({
imports: [NativeScriptRouterModule.forRoot(routes, { enableTracing: true })],
exports: [NativeScriptRouterModule]

})

我看到了痕迹,我意识到我的重定向路径中没有 registeredRoute!

const routes: Routes = [
{ path: '', redirectTo: 'registeredRoute', pathMatch: 'full' },
{
    path: "registeredRoute", component: RegisteredLayoutComponent, canActivate: [AuthGuard], children: [
        { path: "", component: HomeComponent, outlet: "homeTab" },
        { path: "homePage", component: HomeComponent, outlet: "homeTab" },
        { path: "topicsPage", component: TopicsComponent, outlet: "topicsTab" },
        { path: "newsPage", component: NewsComponent, outlet: "newsTab" },
        { path: "askPage", component: AskComponent, outlet: "askTab" },
        { path: "morePage", component: MoreComponent, outlet: "moreTab" }
    ]
},
{
    path: "", component: UnregisteredLayoutComponent, children: [
        { path: '', redirectTo: 'loginPage', pathMatch: 'full' },
        { path: "loginPage", component: LoginComponent }

    ]
    ,
},
 { path: '**', redirectTo: '', pathMatch: 'full' }

];

登录后您试图相对导航,但您应该加载不同的模块(根据您的路由器设置,登录在 unRegisteredRoute 下,tabview 在 registeredRoute 下)。

this.router.navigate(["/registeredRoute", { outlets: { topicsTab: ['topicsPage'], newsTab: ['newsPage'], homeTab: ['homePage'], askTab: ['askPage'], moreTab: ['morePage'] } }]);

Updated Playground