1 Star 0 Fork 1

constantine/hltmapp-mui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
topic-detail.html 3.76 KB
一键复制 编辑 原始数据 按行查看 历史
uwjxas 提交于 2016-07-29 16:56 . init
<!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">
<link rel="stylesheet" href="css/media.css" />
<link rel="stylesheet" href="css/app.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>
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
<div class="mui-scroll">
<div id="list"></div>
</div>
</div>
<script type="text/template" id="tpl">
<ul class="mui-table-view recom">
<% _.each(list, function(v, i){ %>
<li class="mui-table-view-cell" data-url="<%=v.url%>">
<a href="javascript:;">
<div class="media">
<div class="media-left">
<img src="<%=v.img%>" width="77" />
</div>
<div class="media-body">
<div style="font-size: 16px; font-weight: 400;"><%=v.name%></div>
<p><%=v.lastest%></p>
<p>下载<%=v.download%></p>
<p>类型<%=v.type%></p>
<p>地区<%=v.local%></p>
</div>
</div>
</a>
</li>
<% }) %>
</ul>
</script>
<script src="js/mui.min.js"></script>
<script src="js/zepto.min.js"></script>
<script src="js/underscore.js"></script>
<script src="js/common.js"></script>
<script>
var tplRender = _.template($("#tpl").html());
var page = 1,
url,title;
mui.init({
swipeBack: true,
pullRefresh: {
container: '#pullrefresh',
down: {
callback: pulldownRefresh
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
if (mui.os.plus) {
mui.plusReady(function() {
url = plus.webview.currentWebview().url;
title = plus.webview.currentWebview().title;
$(".mui-title").html(title);
setTimeout(function() {
mui('#pullrefresh').pullRefresh().pullupLoading();
}, 400);
});
} else {
mui.ready(function() {
mui('#pullrefresh').pullRefresh().pullupLoading();
});
}
function pulldownRefresh() {
page = 1;
$.ajax({
url: Common.api + '/topicDetail',
async: true,
cache: false,
method: 'get',
dataType: 'json',
data: {
url: url,
page: page
},
success: function(data) {
if(!data.lastPage) {
page++;
}
$("#list").html(tplRender(data));
mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
//必须在页面渲染好了再注册tap事件,否则不生效
$(".recom").on("tap", "li", function() {
var url = $(this).attr("data-url");
Common.open("animate-detail.html", "animate-detail.html", {
url: encodeURIComponent(url)
});
});
}
});
}
function pullupRefresh() {
$.ajax({
url: Common.api + '/topicDetail',
async: true,
cache: false,
method: 'get',
dataType: 'json',
data: {
url: url,
page: page
},
success: function(data) {
if(!data.lastPage) {
page++;
}
$("#list").append(tplRender(data));
mui('#pullrefresh').pullRefresh().endPullupToRefresh(data.lastPage); //参数为true代表没有更多数据了。
//必须在页面渲染好了再注册tap事件,否则不生效
$(".recom").on("tap", "li", function() {
var url = $(this).attr("data-url");
Common.open("animate-detail.html", "animate-detail.html", {
url: encodeURIComponent(url)
});
});
}
});
}
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/constantine008/hltmapp-mui.git
git@gitee.com:constantine008/hltmapp-mui.git
constantine008
hltmapp-mui
hltmapp-mui
master

搜索帮助