yeardlry
yeardlry
  • 发布:2017-08-28 18:07
  • 更新:2017-08-29 23:53
  • 阅读:1145

mui双webview上拉加载问题

分类:MUI

使用双view(alarms.html+alarmView.html)的时候pullRefresh不知道放哪

mui.init({  
                subpages: [{  
                    url: '../html/alarmView.html',   
                    id: 'alarmView',  
                    styles: {  
                        top: 44,   
                    }  
                }],  
                pullRefresh: {  
                    container: '#scroll2',  
                    up: {  
                        height: 50,  
                        auto: false,  
                        contentrefresh: "正在加载...",  
                        contentnomore: '没有更多数据了',   
                        callback: function() {  
                            console.log(123)  
                        },   
                    }  
                }  
            });

如果放到将‘pullRefresh’ alarmView.html里面 上下滚动就没有 放到alarms.html里面 没有效果
某度到的也没有很好的详解

2017-08-28 18:07 负责人:无 分享
已邀请:
LLgg

LLgg

主页面

<!DOCTYPE html>  
<html>  
    <head>  
        <meta charset="utf-8">  
        <title>主页面</title>  
        <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">  
        <link rel="stylesheet" href="css/mui.min.css">  
    </head>  
    <body>  
<header class="mui-bar mui-bar-nav">  
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>  
    <h1 class="mui-title">测试列表</h1>  
</header>  

    </body>  
    <script src="js/mui.min.js"></script>  
    <script type="text/javascript">  
        mui.init({  
            subpages:[{          //调用子页面刷新的代码  
                url:'xxxxxxxxxxxx.html',   //子页面的地址  
                id:'xxxxxxxxxxxx.html',     //子页面的id,可以自己根据需求随便设置  
                styles:{  
                    top: '45px',            //子页面距离顶部的距离  
                    bottom: '0px',         //子页面距离底部的距离  
                }  
            }]  
        });  
    </script>  
</html>

子页面

<!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></title>  
    <link href="css/mui.min.css" rel="stylesheet"/>  
</head>  

<body>  
<div class="mui-content">  
    <div id="pullrefresh" class="mui-content mui-scroll-wrapper">  
        <div class="mui-scroll">  
            <!--数据列表-->  
            <ul class="mui-table-view mui-table-view-chevron mt50">  
                <li class="mui-table-view-cell">  
                    <a href="sp-upcoming-test-detail.html" class="mui-navigate-right">人员名称: 王某某</a>  
                </li>  
            </ul>  
        </div>  
    </div>  
</div>  

</body>  
<script src="js/mui.min.js"></script>  
<script type="text/javascript" charset="utf-8">  
    mui.init({  
        pullRefresh: {  
            container: '#pullrefresh',  
            down: {  
                callback: pulldownRefresh  
            }  
        }  
    });  

    /**  
     * 下拉刷新具体业务实现  
     */  
    function pulldownRefresh() {  
        setTimeout(function () {  
            var table = document.body.querySelector('.mui-table-view');  
            var cells = document.body.querySelectorAll('.mui-table-view-cell');  
            for (var i = cells.length, len = i + 3; i < len; i++) {  
                var li = document.createElement('li');  
                li.className = 'mui-table-view-cell';  
                li.innerHTML = '<a class="mui-navigate-right">人员名称:  ' + (i + 1) + '</a>';  
                //下拉刷新,新纪录插到最前面;  
                table.insertBefore(li, table.firstChild);  
            }  
            mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed  
        }, 1000);  
    }  

</script>  
</html>

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