使用ionic(選項(xiàng)卡欄tab) icon(圖標(biāo)) ionic上拉菜單(ActionSheet) 實(shí)現(xiàn)通訊錄界面切換實(shí)例代碼
廢話不多說(shuō)了,直接給大家貼代碼了,具體代碼如下所示:
<!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ì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
JavaScript使用Promise封裝Axios進(jìn)行高效開(kāi)發(fā)
這篇文章主要介紹了JavaScript使用Promise封裝Axios進(jìn)行高效開(kāi)發(fā),Axios是一個(gè)基于Promise的HTTP庫(kù),它可以幫助我們更方便地發(fā)起HTTP請(qǐng)求,并且提供了許多高級(jí)功能,感興趣的同學(xué)可以參考下文2023-05-05
利用JavaScript構(gòu)建樹(shù)形圖的方法詳解
?樹(shù)形圖可視化廣泛用于分層數(shù)據(jù)分析。如果你沒(méi)有經(jīng)驗(yàn)還想創(chuàng)建一個(gè),那將會(huì)有些復(fù)雜。下面是一個(gè)詳細(xì)教程,教你如何使用JavaScript創(chuàng)建交互式樹(shù)形圖2022-06-06
PHP實(shí)現(xiàn)記錄代碼運(yùn)行時(shí)間封裝類(lèi)實(shí)例教程
這篇文章主要給大家介紹了利用PHP實(shí)現(xiàn)記錄代碼運(yùn)行時(shí)間的封裝類(lèi)的相關(guān)教程,文中給出了詳細(xì)的示例代碼供大家參考學(xué)習(xí),需要的朋友可以參考下2017-05-05
用js限制網(wǎng)頁(yè)只在微信瀏覽器中打開(kāi)(或者只能手機(jī)端訪問(wèn))
這篇文章主要介紹了用js限制網(wǎng)頁(yè)只在微信瀏覽器中打開(kāi),很多電影站也是這么限制的,原因你懂的,需要的朋友可以參考下2020-01-01
JavaScript DOM節(jié)點(diǎn)操作方式全面講解
DOM(Document Object Model 文檔對(duì)象模型)定義了訪問(wèn)和操作文檔的標(biāo)準(zhǔn)方法。整個(gè)瀏覽器網(wǎng)頁(yè)就是一個(gè)Dom樹(shù)形結(jié)構(gòu),這篇文章主要介紹了JavaScript DOM節(jié)點(diǎn)操作方式2022-10-10
js實(shí)現(xiàn)分享到隨頁(yè)面滾動(dòng)而滑動(dòng)效果的方法
這篇文章主要介紹了js實(shí)現(xiàn)分享到隨頁(yè)面滾動(dòng)而滑動(dòng)效果的方法,實(shí)例分析了javascript操作頁(yè)面元素滾動(dòng)效果的方法,需要的朋友可以參考下2015-04-04
js控件Kindeditor實(shí)現(xiàn)圖片自動(dòng)上傳功能
這篇文章主要為大家詳細(xì)介紹了js控件Kindeditor實(shí)現(xiàn)圖片自動(dòng)上傳功能的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-06-06

