温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ionic怎么实现底部分享功能

发布时间:2021-05-18 09:51:21 来源:亿速云 阅读:136 作者:小新 栏目:web开发

这篇文章将为大家详细讲解有关ionic怎么实现底部分享功能,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

具体内容如下

<!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">
<!--页面头部-->
<ion-header-bar class="bar-royal">
  <h2 class="title">我是标题</h2>
</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">
  <h2 class="title">我是底部</h2>
  <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>

关于“ionic怎么实现底部分享功能”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI