通过CSS隐藏tabs
查询官方资料,有一个
tabs-item-hide类用于隐藏 tabs,这个css是ionic.css中自带的一个简单的样式。
tabs html
<ion-tabs class="tabs-icon-top tabs-color-active-positive"
ng-class="{'tabs-item-hide': $root.hideTabs}">
<!-- tabs -->
</ion-tabs>
在该控制器下加上 directive
var module = angular.module('app.directives', []);
module..directive('hideTabs', function ($rootScope) {
return {
restrict: 'A',
link: function (scope, element, attributes) {
scope.$on('$ionicView.beforeEnter', function () {
scope.$watch(attributes.hideTabs, function (value) {
$rootScope.hideTabs = value;
});
});
scope.$on('$ionicView.beforeLeave', function () {
$rootScope.hideTabs = false;
});
}
};
})
在html页面中引用hide-tabs
通过指令
hide-tabs的值指定 是否隐藏 tabs
<ion-view title="New Entry Page" hide-tabs="false">
<!-- view content -->
</ion-tabs>
1239



被折叠的 条评论
为什么被折叠?



