From f1e6abd44aa2ab55e2fcb85e7950ed95af52f72e Mon Sep 17 00:00:00 2001 From: fanfan Date: Tue, 12 Mar 2024 18:58:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/category/index.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/category/index.vue b/pages/category/index.vue index 9eb89e2..5045244 100644 --- a/pages/category/index.vue +++ b/pages/category/index.vue @@ -85,11 +85,10 @@ if (index == this.current) return; this.scrollRightTop = this.oldScrollTop; this.$nextTick(function() { - this.current = index; + // this.current = index; this.scrollRightTop = this.arr[index]; this.leftMenuStatus(index); }) - console.log(index, this.current) }, getGoodsTypeList() { const that = this; @@ -148,7 +147,7 @@ await this.getElRect('menu-scroll-view', 'menuHeight'); await this.getElRect('u-tab-item', 'menuItemHeight'); } - // this.current = index+1; + this.current = index; // 将菜单活动item垂直居中 this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2; @@ -192,7 +191,7 @@ let height2 = this.arr[i + 1]; // 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 if (!height2 || scrollHeight >= height1 && scrollHeight < height2) { - this.leftMenuStatus(i); + this.leftMenuStatus(i+1); return; } }