BootstrapCommon.js 462 B

123456789101112131415161718192021
  1. export default {
  2. countPerPage: 5,
  3. pagerInit:function (datas,countPerPage) {
  4. var arr = [];
  5. if (countPerPage==undefined||countPerPage<=0){
  6. countPerPage = 5;
  7. }
  8. for (var i = 0; i < datas.length; i ++) {
  9. if (i % countPerPage === 0) {
  10. arr.push([]);
  11. arr[Math.floor(i / countPerPage)].push(datas[i]);
  12. } else {
  13. arr[Math.floor(i / countPerPage)].push(datas[i]);
  14. }
  15. }
  16. return arr;
  17. },
  18. }