ionic-底部分享功能

xiaoxiao2021-02-28  11

<!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"> <script src="js/lib/ionic1/js/ionic.bundle.min.js"></script> <title>Title</title> </head> <body ng-controller="myCtrl"> <!--页面头部--> <ion-header-bar class="bar-royal"> <h1 class="title">我是标题</h1> </ion-header-bar> <!--内容--> <ion-content> <!-- 1.添加下拉刷新的组件 --> <ion-refresher pulling-text="正在刷新页面数据..." on-refresh="doRefresh()"> </ion-refresher> <!--ng-repent 渲染内容--> <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> <!--页面底部--> <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+"我是首页展示") } //下拉刷新 $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.6miu.com/read-200430.html

最新回复(0)