zoukankan      html  css  js  c++  java
  • mui中slider的上拉刷新下拉加载

    var flag1 = false;
    var flag2 = false;

    var page1 = 1;
    var page2 = 1;

    $$.ready(function() {
    //循环初始化所有下拉刷新,上拉加载。
    $$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
    //console.log(index)
    $$(pullRefreshEl).pullToRefresh({
    down: {
    callback: function() {
    var self = this;
    if (index == 0) {
    setTimeout(function() {
    GetNoCompletEnterprise(1, 0);
    self.endPullDownToRefresh(flag1);
    self.refresh(true);
    }, 500);
    } else if (index == 1) {
    setTimeout(function() {
    GetCompletEnterprise(1, 0);
    self.endPullDownToRefresh(flag2);
    self.refresh(true);
    }, 500);
    }
    }
    },
    up: {
    auto: true,
    contentnomore: '没有更多数据了',
    callback: function() {
    var self = this;
    if (index == 0) {
    setTimeout(function() {
    GetNoCompletEnterprise(page1, 1);
    self.endPullUpToRefresh(flag1);
    }, 500);
    } else if (index == 1) {
    setTimeout(function() {
    GetCompletEnterprise(page2, 1);
    self.endPullUpToRefresh(flag2);
    }, 500);
    }
    }

    }
    });
    });

    });

    function GetCompletEnterprise(thepage, init) {
    $.ajax({
    type: "get",
    contentType: "application/json;charset=utf-8",
    url: ServerIp + '/api/rectify/rectificationEnterList',
    data: {
    page: thepage,
    unit: localStorage.getItem('unitId'),
    state: 1,
    enterprise: $('#search').val()
    },
    dataType: "json",
    success: function(data) {
    if (data != null && data != undefined) {
    flag2 = data.length == 0 || data.length < 10;
    if (flag2 == false) {
    page2++;
    }
    mui('#item2mobile .mui-scroll').pullToRefresh().endPullUpToRefresh(flag2);
    Bind_data(thepage, '#item2mobile .mui-scroll', data, init);
    }
    },
    error: function(result, status) {

    }
    });
    }

  • 相关阅读:
    图灵科普系列丛书封面有奖征集(贴图送书)
    图灵2010.03书讯
    博客园图灵杯第4届博问大赛(2.27~3.27)
    asp.net运行原理
    IIS与NET桥梁
    offsetParent解释
    XML 操作类库(开源项目)
    W3C不兼容问题(最根本的原因,及解决方案)
    深入理解JavaScript系列
    HttpApplication对象创建的细节
  • 原文地址:https://www.cnblogs.com/yyjspace/p/11599195.html
Copyright © 2011-2022 走看看