4***@qq.com
4***@qq.com
  • 发布:2017-04-10 14:40
  • 更新:2020-06-15 14:02
  • 阅读:16509

Uncaught TypeError: mui(...).pullRefresh(...).endPullupToRefresh is not a function

分类:MUI


一直提示“mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(true);”这句代码出错!
不知道什么原因?请大神些指点指点....谢谢~

方便大神指点,谢谢~~补充贴出源代码:

<!DOCTYPE html>  
<html>  

    <head>  
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />  
        <title>List</title>  
        <script src="js/jquery.js"></script>  
        <script src="js/mui.js"></script>  
        <link href="css/mui.css" rel="stylesheet" />  
        <link href="css/comm.css" rel="stylesheet" />  

    </head>  

    <body>  
        <header class="mui-bar mui-bar-nav hearersceondbg">  
            <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>  
            <h1 class="mui-title" id="pagetitle"></h1>  
        </header>  
        <div class="mui-content" id="bodylist">  
            <div class=" mui-scroll-wrapper" id="pullrefreshcontent">  
                <div class="contentshowIndexunit mui-scroll">  
                <div class="second-banner"> <img src="images/second-banner.jpg" /></div>  
                    <div class="indexUnittit" id="proshowtit"></div>  
                    <div class="listshow" id="descriptionid"></div>  
                    <div class="listshow" id="backgroundid"></div>  

                    <ul class="mui-table-view" id="vessel" style="border-bottom: 0px;">  

                    </ul>  
                </div>  

                <div class="contentend" id="pageend" style="display: none;">---- END -----</div>  
            </div>  
        </div>  

        <script type="text/javascript">  
            var id = '';  
            var page = 1;  
            var productcount = 0;  
            mui.init({  
                pullRefresh: {  
                    container: '#pullrefreshcontent',  
                    up: {  
                        contentrefresh: 'Loading...',  
                        contentinit: '----END----',  
                        contentdown: 'Pull-Show more',  
                        contentnomore: '----END----',  
                        callback: pullupRefreshConfun  
                    }  
                }  
            });  

            function pullupRefreshConfun() {  
                if(productcount < 31) {  
             mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(true);  

                } else {  

                    page++;  
                    loadData();  
            }  

        }  

            function loadData() {  
                productcount = 0;  
                mui.ajax(apiurl + "app_get_products", {  
                    async: true,  
                    dataType: "json",  
                    data: {  
                        id: id,  
                        page: page  
                    },  
                    success: function(data) {  
                        var str = "";  

                        var len = 0;  
                        for(var tmp in data) {  
                            len++;  
                            productcount++;  
                        }  

                        for(var i = 0; i < len; i++) {  

                            var tmp = data[i];  
                            if(i == 0) {  
                                $("#proshowtit").text(tmp["Category"]);  
                                $("#pagetitle").text(tmp["Category"]);  
                                var txt = tmp["Description"];  
                                txt = txt.replace(/<a (.*?)>/ig, '');  
                                txt = txt.replace(/<\/a>/ig, '');  
                                $("#descriptionid").html(txt);  

                                txt = tmp["Background"];  
                                txt = txt.replace(/<a (.*?)>/ig, '');  
                                txt = txt.replace(/<\/a>/ig, '');  
                                $("#backgroundid").html(txt);  

                                continue;  
                            }  

                            if(tmp["Structure"] == "")  
                                tmp["Structure"] = "images/default-pic.png";  

                            var img = "<img class='mui-media-object mui-pull-left' src='" + tmp["Structure"] + "' />"  
                            var p = "<p class='mui-ellipsis'>Cas:" + tmp["CAS Number"] + "</p>";  
                            var div = "<div class='ui-media-body mui-ellipsis'>" + tmp["Product Name"] + "" + p + "</div>";  
                            str += "<li class='mui-table-view-cell mui-media'><a class='mui-navigate-right' href='show.html?id=" + tmp["ID"] + "'>" +img+ div + "</a></li>";  

                        }  
                        str = $("#vessel").html() + str;  
                        $("#vessel").html(str);  
                        //alert($("#vessel").html());  
                    if(productcount < 31) {  

                        mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(true);  

                    } else{  

                            mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(false);  
                        }  
                    },  
                    error: function(data) {  
                        mui.toast("error");  
                    }  
                });  
            }  

            function plusReady() {  

                var t = window.location.search;  
                var len = t.length;  
                id = t.substring(t.indexOf("=", 0) + 1, len);  
                id = decodeURIComponent(id);  
                loadData();  

                mui('#bodylist').on('tap', 'a', function() {  
                    var id = this.getAttribute('href');  
                    var href = this.href;  
                    var webview_style = {  
                        popGesture: "close"  
                    };  

                    mui.openWindow({  
                        id: id,  
                        url: this.href,  
                        styles: webview_style,  
                        show: {  
                            aniShow: 'none'  
                        },  
                        waiting: {  
                            autoShow: false  
                        }  
                    });  
                });  

            }  
            if(window.plus) {  
                plusReady();  
            } else {  
                document.addEventListener("plusready", plusReady, false);  
            }  
        </script>  

    </body>  

</html>
2017-04-10 14:40 负责人:无 分享
已邀请:
Sinea

Sinea - www.sinea.cn

if (mui.os.plus) {  
                mui.plusReady(function() {  
                    setTimeout(function() {  
                        mui('#pullrefresh').pullRefresh().pullupLoading();  
                    }, 500);  

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

我选择的的是延迟执行

2***@qq.com

2***@qq.com

老的API使用endPullupToRefresh,新的API使用endPullup,换着用看看效果

CJH

CJH - 我想要的,我自然会认真

endPullupToRefresh,endPullUpToRefresh这两个方法对应的js文件都不一样,你检查下是否这里出错了。如果依然不可以,麻烦上传demo附件,方便帮你找出问题。你上传的源码符号被转译了...

昨夜西风凋碧树

昨夜西风凋碧树

这个问题怎么解决的朋友?

pk发型不乱

pk发型不乱

你加载的mui.min.js 没这函数。mui示例里有。下载mui示例,把mui.min.js复制并替换你的

1***@qq.com

1***@qq.com

是不是要引用 mui.js
<script type="text/javascript">

大大大静子

大大大静子

我也遇到这样的问题,请问解决了吗?可以分享一下吗?

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