1. 程式人生 > >mui中關於滾動控制元件 scroll 在ios上的bug

mui中關於滾動控制元件 scroll 在ios上的bug

mui.init({ swipeBack: false, pullRefresh: { container: '#pullrefresh', up: { // auto: true, //可選,預設false.首次載入自動上拉重新整理一次 contentrefresh: "正在載入...", //可選,正在載入狀態時,上拉載入控制元件上顯示的標題內容 callback: pullupRefresh } } }); if
(mui.os.plus) { mui.plusReady(function() { setTimeout(function() { console.log("plusAPI載入完畢2!"); mui('#pullrefresh').pullRefresh().pullupLoading();//這句可以自動執行上拉重新整理,有了這句就不要 auto:true }, 1000); }); } else
{ mui.ready(function() { console.log("muiDOM載入完畢!"); mui('#pullrefresh').pullRefresh().pullupLoading();//這句可以自動執行上拉重新整理,有了這句就不要 auto:true }); } var begindate; var enddate; mui.plusReady(function() { console.log("plusAPI載入完畢1!"
); var data = plus.webview.currentWebview(); //可以得到上個頁面攜帶過來的資料 begindate = data.startdate; enddate = data.enddate; }); /** * 上拉載入具體業務實現 */ var page = 1; function pullupRefresh() { console.log("上拉重新整理請求資料開始!"); mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //引數為true代表沒有更多資料了。 getdata(page++, 25, begindate, enddate); console.log("開始結束時間:!" + begindate + "---" + enddate); console.log("本次上拉重新整理請求資料結束!"); } function getdata(page, size, begindate, enddate) { var wd = plus.nativeUI.showWaiting(); console.log("開始網路請求"); mui.post(plus.storage.getItem("url"), { act: "salesreport", username: plus.storage.getItem('TOKEN_USER'), key: plus.storage.getItem('TOKEN_LOGIN'), page: page, size: size, v_begindate: begindate, v_endate: enddate }, function(data) { //伺服器返回響應,根據響應結果,分析是否登入成功; //伺服器返回響應,根據響應結果,分析是否登入成功; console.log("請求成功!"); console.log("響應狀態" + data.status); wd.close(); if(data.status != "1") { mui.alert(data.info); console.log("請求失敗!"); mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); return; } if(data.lists.length == 0) { mui.toast("沒有資料了!"); mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); return; } if(data.status == 1) { var table = document.body.querySelector('.my_table_body'); for(var i = 0; i < data.lists.length; i++) { var tr = document.createElement("tr"); tr.innerHTML = '<td> ' + data.lists[i].attribname + '</td>' + '<td> ' + data.lists[i].attribname1 + '</td>' + '<td> ' + data.lists[i].qty + '</td>' + '<td> ' + data.lists[i].amt + '</td>'; // table.insertBefore(tr, table.lastChild); table.appendChild(tr); //mui('.mui-scroll-wrapper').scroll(); } } if(data.lists.length < size) { mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); return; } }, 'json'); }