gpt4 book ai didi

angular - 带有标签/路由器 socket 的子路由不起作用。 "Error: Cannot match any routes. URL Segment"

转载 作者:行者123 更新时间:2023-12-03 16:49:50 28 4
gpt4 key购买 nike

当我尝试以下操作时:

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: '' }

我收到“错误:无法匹配任何路由。URL 段”

难道我做错了什么?包含路由器 socket 的页面如下所示:
<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' }

];

关于angular - 带有标签/路由器 socket 的子路由不起作用。 "Error: Cannot match any routes. URL Segment",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60348070/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com