http://www.mescroll.com/api.html#options
這里有幾個重要的設置
1、down 下不啟用下拉刷新是因為再手機端有默認的下拉刷新,會沖突,待解決
2、up 中的
auto 是第一次自動加載;
page是設置分頁的size,一般num不在這里設置
clearEmptyId 是沒有數據時顯示提示無數據的容器Id
callback 是回調地址
//創建MeScroll對象 var mescroll = new MeScroll("mescroll", { down: { use: false }, up: { auto: true, page: { size: 5 }, clearEmptyId: "dataList", callback: upCallback //上拉加載的回調 } }); /*上拉加載的回調 page = {num:1, size:10}; num:當前頁 從1開始, size:每頁數據條數 */ function upCallback(page) { //console.log("upCallback_num:" + page.num); var olddata = null; if (page.num !== 1) { olddata = $scope.orders; } $scope.searcher.Page = page.num; $scope.searcher.Rows = page.size; //console.log("Page:" + $scope.searcher.Page + "&Rows:" + $scope.searcher.Rows); $http.post(apiUrl + "api/weixintruck/getlist", $scope.searcher).success( function(data) { //console.log(data.data); if (data.code === 200) { if (data.data.TotalItem > $scope.searcher.CurrentPage * $scope.searcher.PageSize) { $scope.hasNextPage = true; } else { $scope.hasNextPage = false; } $scope.orders = data.data.Items; if (olddata !== null && typeof (olddata) !== "undefined") { $scope.orders = olddata.concat($scope.orders); } mescroll.endBySize($scope.orders.length, data.data.TotalItem); } else { layer.open({ content: '非法操作', skin: 'msg', time: 2 //2秒后自動關閉 }); mescroll.endErr(); } }).error(function() { mescroll.endErr(); }); }