本文實(shí)例為大家分享了ionic底部分享功能的具體代碼,供大家參考,具體內(nèi)容如下
<!DOCTYPE html><html ng-app="myApp"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <link rel="stylesheet" href="js/lib/ionic1/css/ionic.min.css" rel="external nofollow" > <script src="js/lib/ionic1/js/ionic.bundle.min.js"></script> <title>Title</title></head><body ng-controller="myCtrl"><!--頁(yè)面頭部--><ion-header-bar class="bar-royal"> <h1 class="title">我是標(biāo)題</h1></ion-header-bar><!--內(nèi)容--><ion-content> <!-- 1.添加下拉刷新的組件 --> <ion-refresher pulling-text="正在刷新頁(yè)面數(shù)據(jù)..." on-refresh="doRefresh()"> </ion-refresher> <!--ng-repent 渲染內(nèi)容--> <ul class="list"> <li ng-repeat="g in goodses track by $index"> <span ng-bind="g"></span> </li> </ul> <!-- 1.添加上拉刷新的組件 --> <ion-infinite-scroll on-infinite="loadMore()" distance="3%"> </ion-infinite-scroll></ion-content><!--頁(yè)面底部--><ion-footer-bar class="bar-royal"> <h1 class="title">我是底部</h1> <button class="button button-clear" ng-click="share()"><i class="icon ion-share"></i></button></ion-footer-bar><script> var app=angular.module("myApp",["ionic"]); app.controller("myCtrl",["$scope","$ionicActionSheet",function ($scope,$ionicActionSheet) { $scope.goodses=[]; for(var i=0;i<50;i++){ $scope.goodses.push(i+"我是首頁(yè)展示") } //下拉刷新 $scope.doRefresh=function () { $scope.goodses=[]; //下拉載入數(shù)據(jù) for(var i=0;i<50;i++){ $scope.goodses.push(i+"我是下拉載入****") } $scope.$broadcast("scroll.refreshComplete"); } //上拉刷新 $scope.loadMore=function () { //上拉載入數(shù)據(jù) for(var i=0;i<50;i++){ $scope.goodses.push(i+"我是上拉載入++++") } $scope.$broadcast("scroll.infiniteScrollComplete"); } //分享// Action Sheet :(操作表)//表示一個(gè)從下向上滑動(dòng)出現(xiàn)的對(duì)話框// 使用的時(shí)候,需要注入一個(gè)$ionicActionSheet服務(wù)// 服務(wù)有一個(gè)函數(shù)show()用于根據(jù)指定的選項(xiàng)展示這個(gè)對(duì)話框// 函數(shù)內(nèi)必須用return true;進(jìn)行返回,不然對(duì)話框不能關(guān)閉 $scope.share=function () { $ionicActionSheet.show({ buttons: [ { text: '<b>分享</b> 微信' }, { text: '<b>分享</b>QQ ' }, ], destructiveText: '刪除', titleText: '分享', cancelText: '關(guān)閉', buttonClicked: function(index) { return true;//必須 }, destructiveButtonClicked:function () { console.log("刪除按鈕被點(diǎn)擊了****"); return true;//必須 } }); } }])</script></html>
新聞熱點(diǎn)
疑難解答
圖片精選