【问题标题】:Ionic tabs navigation issue离子标签导航问题
【发布时间】:2015-06-12 22:50:00
【问题描述】:

我同时使用 Ionic 框架和 IU 路由器来为我的第一个 Web 应用程序提供更好的导航。

这里有一个简单的架构,所以你可以很容易地理解结构:

我面临的问题是在标签之间导航时我无法保持状态。例如。当我转到下一个选项卡并单击下一个视图并按回车键时,我导航到第一个按钮,当我返回第二个选项卡时,我看不到我离开的相同状态。

我无法解决这个问题。

这是一个演示:PLUNKER DEMO + CODE

这是我的州代码:

.config(function($stateProvider, $urlRouterProvider) {


$stateProvider



    .state('live.today', {
  url: '/today',
  views: {
    today: {
      templateUrl: 'today_live.html',

    }
  }
})

 .state('live.yesterday', {
  url: '/yesterday',
  views: {
    yesterday: {
      templateUrl: 'yesterday_live.html'
    }
  }
})

 .state('live.tomorrow', {
  url: '/tomorrow',
  views: {
    tomorrow: {
      templateUrl: 'tomorrow_live.html'
    }
  }
})



 .state('match.composition', {

  url: '/composition',
  views: {
    view: {
      templateUrl: 'composition.html'
    }
  }
})

 .state('match.resume', {
    cache: false,
  url: '/resume',
  views: {
    view: {
      templateUrl: 'resume.html'
    }
  }
})

 .state('live', {

  url: '/live',
  views: {
    live_view: {
      templateUrl: 'live.html'
    }
  }
})

.state('match', {
    cache: false,
  url: '/match_details',
  views: {
    live_view: {
      templateUrl: 'match_details.html'
    }
  }
})

.state('news', {
    cache: false,
  url: '/news',
  views: {
    news: {
      templateUrl: 'news.html'
    }
  }
})




$urlRouterProvider.otherwise('/live/today');


})

【问题讨论】:

  • 首先感谢您提供demo和图片。但我不明白你的问题吗?你想要的行为是什么?
  • 我面临的问题是在标签之间导航时我无法保持状态。例如。当我转到下一个选项卡并单击下一个视图并按回车键时,然后我导航到第一个按钮,当我返回第二个选项卡时,我看不到我离开的相同状态。
  • 对我来说,您的演示运行良好。

标签: angular-ui-router ionic-framework


【解决方案1】:

最后我找到了一个解决方案,就是在我有三个标签的文件(live.html)中添加“<ion-content> </ion-content>”。

您可以在更新后的演示中为具有相同复杂视图架构的人获取战利品

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多