From 24f1ae8dfb4ecb27986919ee02f5f37b2e4245b3 Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Mon, 4 Sep 2023 16:14:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 14 +++++++------- components/icon-nav/icon-nav.vue | 2 +- components/recommend-hot/recommend-hot.vue | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/App.vue b/App.vue index 48bbb0d8..f277e0f0 100644 --- a/App.vue +++ b/App.vue @@ -1842,17 +1842,17 @@ return color_obj[theme]; }, // 数组分组 - group_arry(array, subGroupLength) { + group_arry(arry, sub_group_length) { let index = 0; - let newArray = []; - if (array.length > subGroupLength) { - while (index < array.length) { - newArray.push(array.slice(index, index += subGroupLength)); + let new_arry = []; + if (arry.length > sub_group_length) { + while (index < arry.length) { + new_arry.push(arry.slice(index, index += sub_group_length)); } } else { - newArray = [array]; + new_arry = [arry]; } - return newArray; + return new_arry; }, }, diff --git a/components/icon-nav/icon-nav.vue b/components/icon-nav/icon-nav.vue index e0082410..9d6d17c8 100644 --- a/components/icon-nav/icon-nav.vue +++ b/components/icon-nav/icon-nav.vue @@ -53,7 +53,7 @@ }, // 数据处理 handle_data() { - this.swiperData = app.globalData.groupArry(this.propData, 10); + this.swiperData = app.globalData.group_arry(this.propData, 10); }, swiper_change(e) { this.current = e.detail.current diff --git a/components/recommend-hot/recommend-hot.vue b/components/recommend-hot/recommend-hot.vue index de55e1fa..6c77f9b6 100644 --- a/components/recommend-hot/recommend-hot.vue +++ b/components/recommend-hot/recommend-hot.vue @@ -107,13 +107,13 @@ let swiperData = []; if (this.hotData.length % 2 == 0) { // 偶数 - swiperData = app.globalData.groupArry(item.d, 2); + swiperData = app.globalData.group_arry(item.d, 2); } else { // 奇数 if (this.hotData.length === i + 1) { - swiperData = app.globalData.groupArry(item.d, 4); + swiperData = app.globalData.group_arry(item.d, 4); } else { - swiperData = app.globalData.groupArry(item.d, 2); + swiperData = app.globalData.group_arry(item.d, 2); } } item.d = swiperData