v-for的数据分组(转)

listTemp: function () {
  var list = this.list;
  var arrTemp = [];
  var index = 0;
  var sectionCount = 3;
  for (var i = 0; i < list.length; i++) {
    index = parseInt(i / sectionCount);
    if (arrTemp.length <= index) {
      arrTemp.push([]);
    }
    arrTemp[index].push(list[i]);
  }
  return arrTemp;
}
 

 

https://blog.csdn.net/xxdddail/article/details/59059548

posted @ 2018-08-30 16:52  haveProgress  阅读(191)  评论(0编辑  收藏  举报