如何使子页面可见离子标签?
How to make ion-tabs visible for the sub-pages?
我希望选项卡出现在整个应用程序中,但我没有在 Ionic 4 中找到任何解决方案。
因为我的项目是一个使用 Ionic 的 angular 项目并且在应用程序的所有子页面上都有离子标签必须处理 angular 导航。
我想在底部显示带有标签的详细信息页面,所以我使用了这种方法:
tabs.router.module.ts 中设置的路线:
{
path: 'tab3',
children: [
{
path: '',
loadChildren: '../tab3/tab3.module#Tab3PageModule'
},
{
path: 'details',
children: [
{
path: '',
loadChildren: '../details/details.module#DetailsPageModule'
},
{
path: 'insideDetails',
loadChildren: '../inside-detail/inside-detail.module#InsideDetailPageModule'
}
]
}
]
}
所以现在详细信息页面和内部详细信息页面将在底部有标签。 url 的详细信息页面是 tabs/tab3/details。
tab3.page.html
<ion-content>
<ion-button (click)='openDetailsInTab()'>Open Details with tab bar</ion-button>
</ion-content>
tab3.page.ts
export class Tab3Page {
constructor(public app: IonApp,
private router: Router) { }
openDetailsInTab() {
this.router.navigateByUrl('/tabs/tab3/details');
}
}
使用 angular 路由器 navigateByUrl 方法路由到该详细信息页面。
我希望选项卡出现在整个应用程序中,但我没有在 Ionic 4 中找到任何解决方案。
因为我的项目是一个使用 Ionic 的 angular 项目并且在应用程序的所有子页面上都有离子标签必须处理 angular 导航。
我想在底部显示带有标签的详细信息页面,所以我使用了这种方法: tabs.router.module.ts 中设置的路线:
{
path: 'tab3',
children: [
{
path: '',
loadChildren: '../tab3/tab3.module#Tab3PageModule'
},
{
path: 'details',
children: [
{
path: '',
loadChildren: '../details/details.module#DetailsPageModule'
},
{
path: 'insideDetails',
loadChildren: '../inside-detail/inside-detail.module#InsideDetailPageModule'
}
]
}
]
}
所以现在详细信息页面和内部详细信息页面将在底部有标签。 url 的详细信息页面是 tabs/tab3/details。
tab3.page.html
<ion-content>
<ion-button (click)='openDetailsInTab()'>Open Details with tab bar</ion-button>
</ion-content>
tab3.page.ts
export class Tab3Page {
constructor(public app: IonApp,
private router: Router) { }
openDetailsInTab() {
this.router.navigateByUrl('/tabs/tab3/details');
}
}
使用 angular 路由器 navigateByUrl 方法路由到该详细信息页面。