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) {

    }
    });
    }

  • 相关阅读:
    How Default Heap Of Process Grows
    希腊字母表
    Ubuntu第一次亲密接触
    Ubuntu中的挂载点(mount point)
    要一专多能
    First touch with JIT debugging
    小学一下环境变量
    安装VMware Tools
    [转]ReiserFS与ext3的比较
    [bbk4485]第二章Flashback Database 05
  • 原文地址:https://www.cnblogs.com/yyjspace/p/11599195.html
Copyright © 2011-2022 走看看