使用应用内浏览器后,Ionic3 setRoot 无法正常工作

问题描述

不幸的是,我需要处理一些使用 Ionic v3.9.5 的遗留代码升级不是一种选择,所以请耐心等待。情况如下:

  1. 用户root page 上,点击一个按钮将他们带到 page A
  2. page A 上,用户点击打开应用内浏览器的不同按钮
  3. 在 IAB 中,用户执行一些与付款相关的操作,然后服务器重定向到结果页面
  4. IAB 使用 loadstart 事件检测此 URL,并将用户重定向到根页面(使用 setRoot 对其进行设置)
  5. 页面的行为很奇怪。单击标题中的按钮不会打开子菜单,但如果我使用滑块轮播,它会打开它。有时其他项目无法正确呈现。

这是 page A 相关代码

const browser: any = this.iab.create('https://www.google.com','_blank',{
  hardwareback: 'no',location: 'no',zoom: 'no',fullscreen: 'yes'
});

let subscription;

subscription = browser.on('loadstart')
  .subscribe(event => {
    // for test,if the URL contains the word "youtube",we will redirect to the RootPage
    if (event.url.indexOf('youtube') > -1) {
      subscription.unsubscribe();
      browser.close();
      this.navCtrl.setRoot('RootPage');
    }
  });

还有一个汉堡菜单,其中包含链接root page 的项目。如果我从任一页面点击它(即使它被弄乱了),一切正常。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)