主页面
<!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>