mui下拉選單
阿新 • • 發佈:2020-07-27
mui下拉選單
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
<div class="mui-scroll">
<ul class="mui-table-view mui-table-view-chevron" id="list">
</ul>
</div>
</div>
var page = 1; //最大頁數 var maxPage = Number.MAX_VALUE; mui.init({ pullRefresh: { container: '#pullrefresh', up: { auto: true, style: 'circle', contentrefresh: "正在重新整理...", height: 50, callback: pullupRefresh } } }); function pullupRefresh() { mui('#pullrefresh').pullRefresh().endPullupToRefresh(page >= maxPage); $.ajax({ url: ctx + "fx/shqzs.api?action=selectTitle&page=" + page, type: 'get', async: false, dataType: 'json', success: function (res) { //首次獲取最大下拉次數 if (page == 1) { let count = res.count; maxPage = count % 20 == 0 ? count / 20 : Math.floor(count / 20) + 1; } $.each(res.data, function (index, item) { var li = "<li class='mui-table-view-cell'><a href='" + ctx + "shqzs/fileDeatil?titleId=" + item.id + "' class='mui-navigate-right'>[" + item.time + "]" + item.title + " </a> </li>" $("#list").append(li); }) } } ) page++; }