Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6p/6sp/7p出现下拉后原列表不显示问题 #7

Closed
allycs opened this issue Aug 15, 2017 · 5 comments
Closed

6p/6sp/7p出现下拉后原列表不显示问题 #7

allycs opened this issue Aug 15, 2017 · 5 comments

Comments

@allycs
Copy link

allycs commented Aug 15, 2017

当列表内容少于1页,手动执行下拉刷新或者下拉其他操作会导致该页面已有的列表项不显示。

@mescroll
Copy link
Owner

列表内容少于1页,应该在mescroll.endSuccess( dataSize ); 传入dataSize,内部会自动判断已无下一页~

如果是列表内容没有暂满屏幕,还有下一页,需要自动加载下一页的话,可配置up:{ loadFull: {use : true} },自动加载满屏

多看看案例和文档哦

@allycs
Copy link
Author

allycs commented Aug 16, 2017

小姐姐太给力,问题依旧

@allycs
Copy link
Author

allycs commented Aug 16, 2017

 var size = 5;
            var mescroll = new MeScroll("mescroll", {
                down: {
                    auto: true,
                    isBoth: false,
                    callback: downCallback
                },
                up: {
                    auto: true,
                    isBoth: false,
                    loadFull: { use: true, delay: 500  },
                    htmlNodata:'<p class="upwarp-nodata">-- 已到底 --</p>',
                    callback: upCallback
                }
            });
            function downCallback() {
                $.ajax({
                    url: '@Url.Content("~/content-hub/news/")' + departmentId + '/' + menuId + '/0/' + firstId + '/' + size,
                    success: function (data) {
                        var result = '';
                        var arrLen = data.newsList.length;
                        alert(arrLen);
                        if (arrLen < 7)
                            mescroll.endSuccess(arrLen);
                        else
                            mescroll.endSuccess();
                        if (arrLen > 0) {
                            firstId = data.firstNewsId;
                            lastId = data.lastNewsId;//0:为刷新,若10:则仅更新firstId;
                            result = getHtml(data.newsList);
                            $('.article_list_' + menuId).html(result);
                            console.log();
                        }
                        //$("#mescroll").removeClass("mescroll-hardware");
                        //$(".article_list_" + menuId).show();
                    },
                    error: function (data) {
                        mescroll.endErr(); 
                    }
                });
            }

            function upCallback(page) {
                $.ajax({
                    url: '@Url.Content("~/content-hub/news/")' + departmentId + '/' + menuId + '/20/' + lastId + '/' + size,//20:标签后增加;10:标签前增加;0:刷新
                    success: function (data) {
                        var arrLen = data.newsList.length;
                        if (arrLen == 0)
                            mescroll.endSuccess(0);
                        else
                            if (arrLen < 5)
                                mescroll.endSuccess(5);
                            else
                                if (arrLen == 5)
                                    mescroll.endSuccess(100);
                        if (arrLen > 0) {
                            lastId = data.lastNewsId;
                            result = getHtml(data.newsList);
                            $('.article_list_' + menuId).append(result);
                        }
                    },
                    error: function (data) {
                        mescroll.endErr();
                    }
                });
            }

@mescroll
Copy link
Owner

亲 size不能这样修改的; 如果你要修改一页5条数据,必须在new Mescroll的时候配置
//创建MeScroll对象 var mescroll = new MeScroll("mescroll", { down: { page: {size: 5} //配置每页加载5条数据 }, up: { callback: upCallback } });

@mescroll
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants