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; } }