嗨,我正在尝试使用下面的代码在ionic 4的父页面中添加两个子页面的两个子页面,但是当我选择要显示各个页面的选项卡但其直接显示child1时,我对不显示两个选项卡感到困惑页面
我想知道我何时可以正常使用它,请向我建议我在哪里做错了?
<ion-content padding>
<ion-row>
<ion-col col-4><button ion-button color="secondary" (click)="child1()">Child1</button></ion-col>
<ion-col col-4><button ion-button color="secondary" (click)="child2()">Child2</button></ion-col>
</ion-row>
<ion-router-outlet></ion-router-outlet>
</ion-content>
const routes: Routes = [
{
path: 'Admin',
component: AdminPage,
children: [
{ path: '',redirectTo: '/Admin/Child1',pathMatch: 'full'},
{ path: 'Child1', component: Child1Page },
{ path: 'Child2', component: Child2Page },
]
}
];
@NgModule({
imports: [
CommonModule,
IonicModule,
AdminRoutingModule
],
declarations: [
AdminPage,
Child1Page,
Child2Page
]
})
export class AdminModule {
}
答案 0 :(得分:0)
尝试使用成角度的router-outlet
而不是ion-router-outlet