开发app过程中需要进行子页面tabs隐藏,网上找了N多方案,度娘出来的都是写指令,

 
 
但是测试中bug明显,于是墙外谷歌。。终于找到完美的方法,如下
 tabs.html
<ion-tabs class=" " ng-controller="TabsCtrl" ng-class="{'tabs-item-hide': hideTabs}">
</ion-tabs>
controller里
.controller('TabsCtrl', function($scope, $rootScope, $state) {
        $rootScope.$on('$ionicView.beforeEnter', function() {
var statename = $state.current.name;
//tabs中存在的主页面不需要隐藏,hidetabs=false
            if(statename ==='tabs.a'||statename ==='tabs.b'||statename ==='tabs.c'){
$rootScope.hideTabs = false;
}else{
$rootScope.hideTabs = true;
}
        });
    })
 
 
that's all...

相关文章:

  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-07-13
  • 2021-08-28
  • 2021-10-29
猜你喜欢
  • 2022-12-23
  • 2021-07-11
  • 2022-12-23
  • 2021-12-17
  • 2021-11-18
  • 2021-09-08
相关资源
相似解决方案