离子-无路线匹配

时间:2019-03-26 17:33:40

标签: ionic-framework ionic4 ionic-tabs

我正在尝试使用带有标签的Ionic应用设置路由。当我单击任何选项卡(例如“主页”)时,出现错误:

"ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'tabs/home'
Error: Cannot match any routes. URL Segment: 'tabs/home'"

这似乎很简单,但是在通过ionic docs查看我的代码后,我看不到哪里出了问题,因此我一定会误解。任何指针将不胜感激。

谢谢!

Tab按钮(不确定是否有帮助)

<ion-tab-button tab="home" href="/tabs/(home:home)">
  <ion-icon name="home"></ion-icon>
  <ion-label>Home</ion-label>
</ion-tab-button>

路由:

const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {
        path: '',
        redirectTo: '/tabs/(home:home)',
        pathMatch: 'full'
      },
      {
        path: 'home',
        outlet: 'home',
        component: HomePage
      },
      {
        path: 'add',
        outlet: 'add',
        component: AddPage
      },
      {
        path: ':id',
        outlet: 'edit',
        component: EditPage
      },
      {
        path: ':id',
        outlet: 'details',
        component: DetailsPage
      }
    ]
  },
  {
    path: '',
    redirectTo: '/tabs/(home:home)',
    pathMatch: 'full'
  }
];

0 个答案:

没有答案
相关问题