从一个离子标签到另一个离子的程序化导航问题

时间:2019-02-09 19:40:16

标签: ionic-framework ionic4

我有相同的基于模板的ion-tabs项目生成。我在选项卡1上有一个小的倒计时计时器。当计时器结束时,我想自动转到选项卡2。

我看到的是调用了选项卡2的nginit,但是实际的导航没有发生。该应用程序仍显示选项卡1。

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

我要路由的tab1.ts代码

import { Router } from '@angular/router';

constructor(private core:CoreService,
          private modalController:ModalController,
          private route: Router){

  }

timeOver(){

if(this.core.hasFinished == true){
   this.route.navigate(['tabs/tab2'])
  return true
}
return false
  }

0 个答案:

没有答案
相关问题