代码拉取完成,页面将自动刷新
同步操作将从 sectong/yidongyiapp 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello MUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
</head>
<body>
<!--下拉刷新容器-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
<div class="mui-scroll">
<!--数据列表-->
<ul class="mui-table-view mui-table-view-chevron">
</ul>
</div>
</div>
<script src="js/mui.min.js"></script>
<script src="js/app.js"></script>
<script>
var maxid = 0;
var minid = 0;
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
callback: pulldownRefresh
},
// up: {
// contentrefresh: '正在加载...',
// callback: pullupRefresh
// }
}
});
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
var table = document.body.querySelector('.mui-table-view');
var cells = document.body.querySelectorAll('.mui-table-view-cell');
// 获取数据列表
mui.ajax('http://localhost:8080' + '/api/v1/news/getNewsList?startid=' + maxid + '&sort=id,DESC', {
data: {},
dataType: 'json',
timeout: 10000, //超时时间设置为10秒;
success: function(data, status, xhr) {
console.info("get code: %s, maxid: %s, minid: %s", data.code, maxid, minid);
var cc = data.content.content;
// 解析数据并填充cell
if(data.content.totalElements > 0) {
for(var i = data.content.totalElements - 1; i >= 0; i--) {
var dd = new Date(cc[i].datetime);
var li = document.createElement('li');
li.className = 'mui-table-view-cell mui-media';
var str = '<a class="mui-navigate-right">';
str += '<img class="mui-media-object mui-pull-left" src="images/cbd.jpg">';
str += '<div class="mui-media-body">' + cc[i].title + '<p class = "mui-ellipsis" > ' +
dd.toLocaleDateString() + ' ' +
dd.toLocaleTimeString() + ' </div>';
str += '</a>';
li.innerHTML = str;
//下拉刷新,新纪录插到最前面;
table.insertBefore(li, table.firstChild);
}
maxid = cc[0].id;
minid = cc[data.content.totalElements - 1].id;
plus.nativeUI.toast('更新新闻条目:' + data.content.totalElements);
console.info("after view ==> maxid: %s, minid: %s", maxid, minid);
}
}
});
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
if(mui.os.plus) {
mui.plusReady(function() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().pulldownLoading();
}, 1000);
});
} else {
mui.ready(function() {
mui('#pullrefresh').pullRefresh().pulldownLoading();
});
}
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。