离子选项卡不会转到下一页

时间:2019-06-28 20:56:24

标签: javascript html ios ionic-framework

我有一个离子应用程序项目,其底部带有选项卡,并且我试图制作一个新选项卡以链接到我创建的新页面,并且当我执行正确的代码时,按下后不会转到该页面新制作的Tab按钮提供了接触式离子支持,他们说它看起来不错,但是他们无法进一步帮助我

这里是我的离子标签代码

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TabsPage } from './tabs.page';

import { FormsPage } from 'forms.page'

const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {
        path: 'tab1',
        children: [
          {
            path: '',
            loadChildren: '../tab1/tab1.module#Tab1PageModule'
          }
        ]
      },
      {
        path: 'parties',
        children: [
          {
            path: '',
            loadChildren: '../tab2/tab2.module#Tab2PageModule'
          }
        ]
      },
      {
        path: 'tab3',
        children: [
          {
            path: '',
            loadChildren: '../tab3/tab3.module#Tab3PageModule'
          }
        ]
      },
      {
        path: '',
        redirectTo: '/tabs/tab1',
        pathMatch: 'full'
      }
    ]
  },
  {
    path: 'forms',
    children: [
      {
        path: '',
        loadChildren: '../forms/forms.module#FormsPageModule'
      }
    ]

  },
  {
    path: '',
    redirectTo: '/tabs/tab1',
    pathMatch: 'full'
  }
  
];

@NgModule({
  imports: [
    RouterModule.forChild(routes)
  ],
  exports: [RouterModule]
})
export class TabsPageRoutingModule {}

<ion-tabs>

  <ion-tab-bar slot="bottom">
    <ion-tab-button tab="tab1">
      <ion-icon name="flash"></ion-icon>
      <ion-label>Tab One</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="parties">
      <ion-icon name="apps"></ion-icon>
      <ion-label>Tab Two</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="tab3">
      <ion-icon name="send"></ion-icon>
      <ion-label>Tab Three</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="forms">
  <ion-icon name="clipboard"></ion-icon>
    <ion-label>Forms</ion-label>
</ion-tab-button>

</ion-tab-bar>

</ion-tabs>

1 个答案:

答案 0 :(得分:0)

尝试使用此配置。

  const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {
        path: 'tab1',
        loadChildren: '../tab1/tab1.module#Tab1PageModule'
      },
      {
        path: 'parties',
        loadChildren: '../tab2/tab2.module#Tab2PageModule'
      },
      {
        path: 'tab3',
        loadChildren: '../tab3/tab3.module#Tab3PageModule'
      }
    ]
  },
  {
    path: 'forms',
    children: [
      {
        path: '',
        loadChildren: '../forms/forms.module#FormsPageModule'
      }
    ]

  },
  {
    path: '',
    redirectTo: '/tabs/tab1'
  }

];

在所有儿童中,请确保具有以下路线:

  const routes: Routes = [
  {
    path: '',
    component: Tab1Page
  }
];

此选项卡中每个子页面的内容。