Commit 4a807ba4 by gao_yingdong

Update car_compontents.vue

parent f2478698
...@@ -342,6 +342,24 @@ export default { ...@@ -342,6 +342,24 @@ export default {
this.page_size = val; this.page_size = val;
this.doQuery("yes"); this.doQuery("yes");
}, },
getNeedArr(array, size) {
const length = array.length;
if (!length || !size || size < 1) {
return [];
}
let index = 0; //用来表示切割元素的范围start
let resIndex = 0; //用来递增表示输出数组的下标
//根据length和size算出输出数组的长度,并且创建它。
let result = new Array(Math.ceil(length / size));
//进行循环
while (index < length) {
//循环过程中设置result[0]和result[1]的值。该值根据array.slice切割得到。
result[resIndex++] = array.slice(index, (index += size));
}
//输出新数组
return result;
},
handleCurrentChange(val) { handleCurrentChange(val) {
let self = this let self = this
this.currentPage1 = val; this.currentPage1 = val;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment