diff --git a/pages/category/index.vue b/pages/category/index.vue index 5045244..600ff9e 100644 --- a/pages/category/index.vue +++ b/pages/category/index.vue @@ -85,17 +85,16 @@ 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); }) }, getGoodsTypeList() { const that = this; - console.log(cstegory.list(), '接口地址') return new Promise((resolve, reject) => { cstegory.list({ - is_hot: 0 + // is_hot: 0 }) .then(res => { // 合并新数据 @@ -147,9 +146,9 @@ await this.getElRect('menu-scroll-view', 'menuHeight'); await this.getElRect('u-tab-item', 'menuItemHeight'); } - this.current = index; // 将菜单活动item垂直居中 this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2; + this.current = index-1; }, // 获取右边菜单每个item到顶部的距离 @@ -166,7 +165,7 @@ } rects.forEach((rect) => { // 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况) - this.arr.push(rect.top - rects[0].top + 5); + this.arr.push(rect.top - rects[0].top); resolve(); }) }).exec()