在Ionic 4.11中前进/后退上一页下一页导航

时间:2019-10-22 11:21:08

标签: angular ionic-framework ionic3 ionic4

我是Ionic的新手,我正在将Ionic 3应用程序升级到ionic 4,这是我的环境设置。

ionic (Ionic CLI)             : 4.11.0 
   Ionic Framework               : @ionic/angular 4.9.0
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : not available
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-i                                                                                                                onic-webview 4.1.1, (and 9 other plugins)

System:

   NodeJS : v10.16.3 
   npm    : 6.9.0
   OS     : Windows 7

我一直试图从html中不同的儿童书籍章节中浏览 最初,我一直使用.ts文件中的navcontroller的navigationForward和navigationBack函数为:

 this.nav.navigateForward('/ch', {queryParams:{chname:chslug}}) 

this.nav.navigateBack('/ch', {queryParams:{chname:chslug}})

Navcontroller已贬值,因此我在.ts文件中使用Router

this.router.navigate(['/chapter',{chapter:slug}],{replaceUrl: true});   

它可以工作,但不能生成相同的前进或后退动画。谁能帮我解决这个问题?我已经尝试解决此问题已有好几天了,尝试在其中的一个选项中尝试在stackoverflow中搜索为

if(direction=='forward')
      {
          this.navCTRL.setDirection('forward');
      }else
      {
        this.navCTRL.setDirection('back');  
        }

this.router.navigate(['/ch',{chname:chslug}]);

但不起作用... 我尝试了其他各种选择,但没有任何效果..,请提供帮助。

谢谢, 扎克

0 个答案:

没有答案