Reference to pull-down refresh of mui

Keywords: PHP Javascript

```javascri[t
mui.init({
pullRefresh: {
Container: " refreshContainer", // to refresh the area identifier, querySelector can locate css selectors, such as: id,. class, etc.
up: {
auto: true, // optional, default false. Auto upload once
Content refresh: "Loading...", // Optional, when loading state, the title content displayed on the pull-up load control
contentnomore:'No more data', / / optional, alert content displayed when no more data is requested;
Callback: pulldown Refresh // optional, refresh function, according to specific business to write, such as through ajax from the server to obtain new data;
}
}
});

    function pulldownRefresh() {
    var flag = false;
    mui.getJSON("/StoreMobile/StoreMember/get_member_data", {
        start: $("#viplistUl li").length,
        count: 20,
        member: 2,
        search: $("#seainput").val()
    }, function (resp) {
        if (resp.code==1) {
            LoadPage(resp.data);
        } else {
            if ($("#ViplistUl ". children (). last (). text ()=" There is no more data ".{
                return
            }
            $("#ViplistUl "). append ("<li style='text-align: center'> No more data </li>");
        }

    });
    this.endPullupToRefresh(flag);
}
    function LoadPage(data) {

    data.forEach(function (ele, index) {

        var listText = '<li onclick="member_detail(' + ele.member_id + ')" class="mui-table-view-cell mui-media"  data-mid="' + ele.member_id + '">\ ' +
            '<div>\ ' +
            '<img class="mui-media-object mui-pull-left" alt=" " src="' + ele.head_image + '">\ ' +
            '<div class="mui-media-body">' + ele.truename + ' <p class="mui-ellipsis">' + ele.login_account + '</p> </div> </div> </li>';
        viplistUl.append(listText);

    });
    band();
}

function InnerPage(data) {
    var listText = "";
    data.forEach(function (ele, index) {

        listText += '<li class="mui-table-view-cell mui-media" id="vip-click" data-mid="' + ele.member_id + '">\ ' +
            '<a href="javascript:;">\ ' +
            '<img class="mui-media-object mui-pull-left" alt=" " src="' + ele.head_image + '">\ ' +
            '<div class="mui-media-body">' + ele.truename + ' <p class="mui-ellipsis">' + ele.login_account + '</p> </div> </a> </li>';
    })
    viplistUl.html(listText);
    band();
}

function band() {
    mui('#viplistUl').on('tap', "li", function () {
        _id = $(this).data("mid");
        window.location.href = "vip_list_xq.html?" + _id
    })
}

The above can be found on mui's official website.

```php
// Get membership information, drop-down loading
    function get_member_data()
    {
        $member_data = I("get.");
        $store_id = $_SESSION["admin"]["store_id"];
        $member = $member_data["member"];
        $count = $member_data["count"];
        $start = $member_data["start"];
        $map["store_id"] = $store_id;
        $map["is_member"] = $member;
        $map["is_disabled"] = 1;
        if ($member_data["search"]) {
            $map["login_account|truename"] = array("like", "%" . $member_data["search"] . "%");
        }
        // Find the corresponding members
        $memberInfo = M("member")->where($map)->limit($start, $count)->order("register_time desc")->field("member_id, login_account,head_image,sex,truename")->select();
        if ($memberInfo) {
            $this->successMsg("Get success", 1, $memberInfo);
        } else {
            $this->errorMsg("Acquisition failure", 0);
        }
    }
The above information can be obtained for the corresponding routing.

If you find that the phone end is not fixed, you can add it in html.

* {
        touch-action: pan-y;
}

.mui-scroll {
        position: relative;
}

Posted by Zpixel on Tue, 08 Oct 2019 15:09:48 -0700