ionic实现底部分享功能

<!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="UTF-8"> <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <link href="https://www.jb51.net/js/lib/ionic1/css/ionic.min.css" > <script src="https://www.jb51.net/js/lib/ionic1/js/ionic.bundle.min.js"></script> <title>Title</title> </head> <body ng-controller="myCtrl"> <!--页面头部--> <ion-header-bar> <h1>我是标题</h1> </ion-header-bar> <!--内容--> <ion-content> <!-- 1.添加下拉刷新的组件 --> <ion-refresher pulling-text="正在刷新页面数据..." on-refresh="doRefresh()"> </ion-refresher> <!--ng-repent 渲染内容--> <ul> <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> <!--页面底部--> <ion-footer-bar> <h1>我是底部</h1> <button ng-click="share()"><i></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+"我是首页展示") } //下拉刷新 $scope.doRefresh=function () { $scope.goodses=[]; //下拉载入数据 for(var i=0;i<50;i++){ $scope.goodses.push(i+"我是下拉载入****") } $scope.$broadcast("scroll.refreshComplete"); } //上拉刷新 $scope.loadMore=function () { //上拉载入数据 for(var i=0;i<50;i++){ $scope.goodses.push(i+"我是上拉载入++++") } $scope.$broadcast("scroll.infiniteScrollComplete"); } //分享 // Action Sheet :(操作表) //表示一个从下向上滑动出现的对话框 // 使用的时候,需要注入一个$ionicActionSheet服务 // 服务有一个函数show()用于根据指定的选项展示这个对话框 // 函数内必须用return true;进行返回,不然对话框不能关闭 $scope.share=function () { $ionicActionSheet.show({ buttons: [ { text: '<b>分享</b> 微信' }, { text: '<b>分享</b>QQ ' }, ], destructiveText: '删除', titleText: '分享', cancelText: '关闭', buttonClicked: function(index) { return true;//必须 }, destructiveButtonClicked:function () { console.log("删除按钮被点击了****"); return true;//必须 } }); } }]) </script> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wysfjz.html