国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > JS > 正文

ionic進入多級目錄后隱藏底部導航欄(tabs)的完美解決方案

2024-05-06 16:33:07
字體:
來源:轉載
供稿:網友

在有tabs的項目里,進入子層級時,底部導航還一直存在,本人是要讓他只在首頁幾個界面存在,其他的隱藏,在這里用到了angularjs的指令,要完成這個步驟分為三步:

在標簽ion-tabs中添加:ng-class=”{‘tabs-item-hide': $root.hideTabs}”,源碼如下

<ion-tabs class="tabs-icon-top" ng-class="{'tabs-item-hide': $root.hideTabs}"> //tabs </ion-tabs>

添加angularjs的指令,源碼如下:

//app已經在其他文件中指定,如var app = angular.module("starter",["ionic"]) app.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 = 'tabs-item-hide'; }); }); scope.$on('$ionicView.beforeLeave', function() { scope.$watch(attributes.hideTabs, function(value){ $rootScope.hideTabs = 'tabs-item-hide'; }); scope.$watch('$destroy',function(){ $rootScope.hideTabs = false; }) }); } }; });

在想要隱藏的界面標簽 ion-view添加表達式hide-tabs=”true”,源碼如下:

//這是官網模板中的文件 <ion-view hide-tabs="true" view-title="{{chat.name}}"> <ion-content class="padding"> <img ng-src="{{chat.face}}" style="width: 64px; height: 64px"> <p> {{chat.lastText}} </p> </ion-content> </ion-view>

以上所述是小編給大家介紹的ionic進入多級目錄后隱藏底部導航欄(tabs)的完美解決方案,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VeVb武林網網站的支持!


注:相關教程知識閱讀請移步到JavaScript/Ajax教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 台中县| 和政县| 谷城县| 澳门| 毕节市| 娄烦县| 伊吾县| 邹平县| 屏东县| 东宁县| 汝南县| 临澧县| 綦江县| 辉县市| 乌兰浩特市| 龙州县| 青浦区| 秦安县| 石棉县| 海盐县| 措美县| 全椒县| 突泉县| 丰原市| 凉城县| 许昌市| 吴川市| 定日县| 瑞丽市| 凤翔县| 上林县| 万宁市| 东丰县| 健康| 西乌| 漳州市| 石阡县| 皋兰县| 米林县| 四会市| 宁海县|