使用ionic(選項(xiàng)卡欄tab) icon(圖標(biāo)) ionic上拉菜單(ActionSheet) 實(shí)現(xiàn)通訊錄界面切換實(shí)例代碼
廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>用ionic(選項(xiàng)卡欄tab) icon(圖標(biāo)) ionic上拉菜單(ActionSheet) 實(shí)現(xiàn)通訊錄界面切換操作</title> <link rel="stylesheet" href="../ionic/css/ionic.css" rel="external nofollow" > <script src="../ionic/js/ionic.bundle.min.js"></script> <script type="text/javascript"> angular.module('myApp', ['ionic']) .controller('RootCtrl', function($scope) { $scope.onControllerChanged = function(oldController, oldIndex, newController, newIndex) { console.log('Controller changed', oldController, oldIndex, newController, newIndex); console.log(arguments); }; }) .controller('HomeCtrl', function($scope, $timeout, $ionicModal, $ionicActionSheet) { $scope.items = []; $ionicModal.fromTemplateUrl('newTask.html', function(modal) { $scope.settingsModal = modal; }); //ionic 上拉菜單(ActionSheet) var removeItem = function(item, button) { $ionicActionSheet.show({ buttons: [], destructiveText: 'Delete Task', cancelText: 'Cancel', cancel: function() { return true; }, destructiveButtonClicked: function() { $scope.items.splice($scope.items.indexOf(item), 1); return true; } }); }; var completeItem = function(item, button) { item.isCompleted = true; }; $scope.onReorder = function(el, start, end) { ionic.Utils.arrayMove($scope.items, start, end); }; $scope.onRefresh = function() { console.log('ON REFRESH'); $timeout(function() { $scope.$broadcast('scroll.refreshComplete'); }, 1000); } $scope.removeItem = function(item) { removeItem(item); }; $scope.newTask = function() { $scope.settingsModal.show(); }; // Create the items $scope.user = [ { name:"Ben Sparrow", words:"You on your way?" }, { name:"Max Lynx", words:"Hey,it's me." }, { name:"Adam Bradleyson", words:"I should buy a boat." }, { name:"Perry Governor", words:"Look at my mukluks!" }, { name:"Mike Harrinqton", words:"This is wicked good ice cream." }, ]; }) </script> </head> <body ng-app="myApp" ng-controller="RootCtrl"> <ion-tabs class="tabs-icon-only tabs-positive"> <ion-tab title="Home" icon-on="ion-ios-filing" icon-off="ion-ios-filing-outline" ng-controller="HomeCtrl"> <ion-header-bar class="bar-stable"> <h1 class="title">Chats</h1> </ion-header-bar> <ion-content has-tabs="true" on-refresh="onRefresh()"> <ion-refresher></ion-refresher> <ion-list scroll="false" on-refresh="onRefresh()" s-editing="isEditingItems" animation="fade-out" delete-icon="icon ion-minus-circled"> <ion-item ng-repeat="item in user" item="item" buttons="item.buttons" can-delete="true" can-swipe="true" on-delete="deleteItem(item)" ng-class="{completed: item.isCompleted}"> <span> <img src="../img/y.jpg" height="56" width="56"/> <p style="margin-left: 66px;margin-top: -50px"><b>{{item.name}}</b></p> <p style="margin-left: 66px;">{{item.words}}</p> <i class="ion-chevron-right" style="float: right;margin-top: -32px""></i> </span> </ion-item> </ion-list> </ion-content> </ion-tab> <ion-tab title="About" icon-on="icon ion-ios-clock" icon-off="icon ion-ios-clock-outline"> <header class="bar bar-header bar-stable"> <h1 class="title">Deadlines</h1> </header> <ion-content has-header="true"> <center> <img src="../img/q.jpg" height="462" width="427"/> </center> </ion-content> </ion-tab> <ion-tab title="Settings" icon-on="icon ion-ios-gear" icon-off="icon ion-ios-gear-outline"> <header class="bar bar-header bar-stable"> <h1 class="title">Settings</h1> </header> <ion-content has-header="true"> <center> <img src="../img/y.jpg" height="462" width="427"/> </center> </ion-content> </ion-tab> </ion-tabs> </body> </html>
總結(jié)
以上所述是小編給大家介紹的使用ionic(選項(xiàng)卡欄tab) icon(圖標(biāo)) ionic上拉菜單(ActionSheet) 實(shí)現(xiàn)通訊錄界面切換實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
JavaScript實(shí)現(xiàn)的字符串replaceAll函數(shù)代碼分享
這篇文章主要介紹了JavaScript實(shí)現(xiàn)的字符串replaceAll函數(shù)代碼分享,本文直接給出實(shí)現(xiàn)代碼,需要的朋友可以參考下2015-04-04webpack5?import動(dòng)態(tài)導(dǎo)入實(shí)現(xiàn)按需加載并給文件統(tǒng)一命名的配置方法
這篇文章主要介紹了webpack5?import動(dòng)態(tài)導(dǎo)入實(shí)現(xiàn)按需加載并給文件統(tǒng)一命名的配置,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-11-11BootStrap實(shí)現(xiàn)帶有增刪改查功能的表格(DEMO詳解)
這篇文章主要介紹了BootStrap實(shí)現(xiàn)帶有增刪改查功能的表格,表格封裝了3個(gè)版本,接下來通過本文給大家展示下樣式及代碼,對(duì)bootstrap增刪改查相關(guān)知識(shí)感興趣的朋友一起通過本文學(xué)習(xí)吧2016-10-10Javascript數(shù)組操作函數(shù)總結(jié)
這篇文章主要給大家匯總介紹了Javascript數(shù)組操作函數(shù),需要的朋友可以參考下2015-02-02JS實(shí)現(xiàn)簡(jiǎn)單的右下角彈出提示窗口完整實(shí)例
這篇文章主要介紹了JS實(shí)現(xiàn)簡(jiǎn)單的右下角彈出提示窗口的方法,可實(shí)現(xiàn)點(diǎn)擊連接右下角彈出提示框的功能,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06HTML5+setCutomValidity()函數(shù)驗(yàn)證表單實(shí)例分享
本文給大家分享的是在HTML5中結(jié)合setCutomValidity()函數(shù)實(shí)現(xiàn)驗(yàn)證表單的實(shí)例,非常的時(shí)間實(shí)用,這里推薦給大家,有需要的小伙伴可以參考下。2015-04-04