阿飞
阿飞
  • 发布:2017-08-17 11:03
  • 更新:2017-08-17 11:33
  • 阅读:1417

上拉与下拉都不触发,且报很多的错

分类:MUI

上拉和下拉时都不会显示“正在加载数据...”这样的提示且都不触方法

我的容器为:

<div id="biometricPage">  
    <!--header-->  
    <header class="mui-bar mui-bar-nav">  
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left icon-color"></a>  
        <!--<a id="biometricSearch" class="iconfont icon-search icon-color mui-icon mui-icon-left-nav mui-pull-right"></a>-->  
        <h1 class="mui-title icon-color"></h1>  
    </header>  
    <div id="pullrefresh" class="mui-content mui-scroll-wrapper">  
        <div class="mui-scroll">  
            <!--数据列表-->  
            <ul id="biometricList" class="mui-table-view mui-table-view-chevron js-view">  
                <li class="mui-table-view-cell"></li>  
            </ul>  
        </div>  
    </div>     
</div>

上拉报错为:

jquery.min.js:3 Uncaught TypeError: ((r.event.special[g.origType] || (intermediate value)).handle || g.handler).apply is not a function  
    at HTMLDivElement.dispatch (jquery.min.js:3)  
    at HTMLDivElement.q.handle (jquery.min.js:3)  
    at Function.i.trigger (mui.min.js:6)  
    at d._drag (mui.min.js:7)  
    at d.handleEvent (mui.min.js:7)  
    at Function.i.trigger (mui.min.js:6)  
    at Object.c [as handle] (mui.min.js:6)  
    at Object.<anonymous> (mui.min.js:6)  
    at mui.min.js:6  
    at Array.every (<anonymous>)

下拉报错为:

jquery.min.js:3 Uncaught TypeError: ((r.event.special[g.origType] || (intermediate value)).handle || g.handler).apply is not a function  
    at HTMLDivElement.dispatch (jquery.min.js:3)  
    at HTMLDivElement.q.handle (jquery.min.js:3)  
    at Function.i.trigger (mui.min.js?1502938736:6)  
    at d.setTranslate (mui.min.js?1502938736:7)  
    at d.scrollTo (mui.min.js?1502938736:7)  
    at d._flick (mui.min.js?1502938736:7)  
    at d.handleEvent (mui.min.js?1502938736:7)  
    at Function.i.trigger (mui.min.js?1502938736:6)  
    at Object.c [as handle] (mui.min.js?1502938736:6)  
    at Object.<anonymous> (mui.min.js?1502938736:6)

我的方法是这样写的:

mui.init({  
        container:'#pullrefresh',  
        pullRefresh: {  
            down: {  
                callback: pulldownRefresh  
            },  
            up: {  
                height:50,  
                contentrefresh: '正在加载...',  
                contentnomore:'没有更多数据了',  
                callback: pullupRefresh  
            }  
        }  
    });  
     mui('.mui-scroll-wrapper').scroll();  

    function pulldownRefresh() {  
        var page = 1;  
        var size = 10;  

        /*第一次加载时取得所有的li*/  
        var table = jQuery('.mui-table-view');  
        var cells = table.find('.mui-table-view-cell');  
        var newCells = {};  
        var url = MyAnviz.baseUrl + '/product/ajax/productlist.html';  
        //查询参数,因为是假数据,因此这个对象没有作为查询参数使用  
        var dataEntity = {  
            "userId": "1",  
            "page": page,  
            "size": size  
        };  
        //刷新加载,更改page  
        dataEntity.page = parseInt(dataEntity.page) + 1;  
        console.log('page:' + dataEntity.page);  

        mui.ajax({  
            type: "GET",  
            url: url,  
            data: dataEntity,  
            dataType: "json",  
            success: function (data) {  
                console.log('data' + data.data);  

                for (var i = 0; i < data.data.length; i++) {  
                    var item = data.data[i];  
                    if(item){  
                        var p_id = item.contentId;  
                        var p_img = item.productorImg;  
                        var p_name = item.productorName;  
                        var p_des = item.productorDes;  
                        var p_url = item.productorUrl;  
                    }  

                    /*新的 数组列表*/  
                    var li = jQuery('<li class="mui-table-view-cell mui-media js-media" data-id="' + p_id + '">' + '<img class="mui-media-object mui-pull-left js-img" src="' + p_img + '" /><div class="mui-media-body js-media-body">' + p_name + '</div>' + '<div class="anviz-ellipsis js-des js-info">' + p_des + '</div></li>');  
                    /*改变cells的length*/  
                    console.log('新的li为:' + li.length);  

                    /*新的li数组添加到第一次加载的10条li的前面*/  
                    cells.push(li[0]);  
                    console.log('新的li数量' + cells.length);  
                    table.append(cells);  
                }  

                 /*table.last().addClass('anviz-media');*/  
                 mui('#pullrefresh').pullRefresh().endPulldownToRefresh();   
                 if (mui.os.plus) {  
                    mui.plusReady(function() {  
                        setTimeout(function() {  
                            mui('#pullrefresh').pullRefresh().pullupLoading();  
                        }, 1000);  

                    });  
                } else {  
                    mui.ready(function() {  
                        mui('#pullrefresh').pullRefresh().pullupLoading();  
                    });  
                }  

            }  
        })  
    }
2017-08-17 11:03 负责人:无 分享
已邀请:
n***@gmail.com

n***@gmail.com

请上传demo吧 我们运行一下看看

  • 阿飞 (作者)

    怎么上传demo?

    2017-08-17 12:11

  • n***@gmail.com

    上传附件。。。。

    2017-08-18 20:22

该问题目前已经被锁定, 无法添加新回复