欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ionic實(shí)現(xiàn)下拉刷新載入數(shù)據(jù)功能

 更新時(shí)間:2017年05月11日 10:31:24   作者:郭浩326  
這篇文章主要為大家詳細(xì)介紹了ionic實(shí)現(xiàn)下拉刷新載入數(shù)據(jù)功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了ionic下拉刷新載入數(shù)據(jù)的具體代碼,供大家參考,具體內(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>
  <!--
  由于移動(dòng)端的特殊性
    下拉刷新ion-refresher:移動(dòng)端沒有刷新的按鈕~圖標(biāo)~可以操作的東西【瀏覽器的工具欄中有刷新的按鈕】
    下拉加載ion-infinite-scroll :移動(dòng)端頁面,顯示的內(nèi)容有限,優(yōu)先加載顯示用戶能看到的內(nèi)容部分,在用戶拖動(dòng)網(wǎng)頁的過程中,【動(dòng)態(tài)加載下面的內(nèi)容;模擬了PC端的延遲加載】
-->
</head>
<body ng-controller="myCtrl">
<!--頁面頭部-->
<ion-header-bar class="bar-royal">
  <h1 class="title">我是標(biāo)題</h1>
</ion-header-bar>
<!--內(nèi)容-->
<ion-content>
  <!-- 1.添加下拉刷新的組件 -->
  <ion-refresher
      pulling-text="正在刷新頁面數(shù)據(jù)..."
      on-refresh="doRefresh()">
  </ion-refresher>

  <!--ng-repent 渲染內(nèi)容-->
<ul class="list">
  <li ng-repeat="g in goodses">
    <span ng-bind="g"></span>
  </li>
</ul>
</ion-content>
<!--頁面底部-->
  <ion-footer-bar class="bar-royal">
    <h1 class="title">我是底部</h1>
  </ion-footer-bar>
<script>
  var app=angular.module("myApp",["ionic"]);
  app.controller("myCtrl",["$scope",function ($scope) {
    $scope.goodses=[];
    for(var i=0;i<50;i++){
      $scope.goodses.push(i+"我是首頁展示")
    }
    $scope.doRefresh=function () {
      //下來載入數(shù)據(jù)
      $scope.goodses=[];
      for(var i=0;i<50;i++){
        $scope.goodses.push(i+"我是下拉載入****")
      }
      /*
       頁面下拉刷新,其實(shí)就是延遲更改數(shù)據(jù)
       數(shù)據(jù)一旦被延遲更新,在Angular中我們通過$scope.$apply()進(jìn)行臟數(shù)據(jù)檢查,
       然后將數(shù)據(jù)同步 ionic中,要通過廣播信號(hào)的方式,
       使用$scope.$broadcase("scroll.refreshComplete")告訴頁面中的所有組件,
       數(shù)據(jù)已經(jīng)刷新完成,可以重新加載數(shù)據(jù)
       */

      // 停止廣播ion-refresher
      $scope.$broadcast('scroll.refreshComplete');
    }
  }])
</script>
</html>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論