|
|
@ -85,11 +85,10 @@ |
|
|
|
if (index == this.current) return; |
|
|
|
if (index == this.current) return; |
|
|
|
this.scrollRightTop = this.oldScrollTop; |
|
|
|
this.scrollRightTop = this.oldScrollTop; |
|
|
|
this.$nextTick(function() { |
|
|
|
this.$nextTick(function() { |
|
|
|
this.current = index; |
|
|
|
// this.current = index; |
|
|
|
this.scrollRightTop = this.arr[index]; |
|
|
|
this.scrollRightTop = this.arr[index]; |
|
|
|
this.leftMenuStatus(index); |
|
|
|
this.leftMenuStatus(index); |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log(index, this.current) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
getGoodsTypeList() { |
|
|
|
getGoodsTypeList() { |
|
|
|
const that = this; |
|
|
|
const that = this; |
|
|
@ -148,7 +147,7 @@ |
|
|
|
await this.getElRect('menu-scroll-view', 'menuHeight'); |
|
|
|
await this.getElRect('menu-scroll-view', 'menuHeight'); |
|
|
|
await this.getElRect('u-tab-item', 'menuItemHeight'); |
|
|
|
await this.getElRect('u-tab-item', 'menuItemHeight'); |
|
|
|
} |
|
|
|
} |
|
|
|
// this.current = index+1; |
|
|
|
this.current = index; |
|
|
|
// 将菜单活动item垂直居中 |
|
|
|
// 将菜单活动item垂直居中 |
|
|
|
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2; |
|
|
|
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2; |
|
|
|
|
|
|
|
|
|
|
@ -192,7 +191,7 @@ |
|
|
|
let height2 = this.arr[i + 1]; |
|
|
|
let height2 = this.arr[i + 1]; |
|
|
|
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 |
|
|
|
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 |
|
|
|
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) { |
|
|
|
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) { |
|
|
|
this.leftMenuStatus(i); |
|
|
|
this.leftMenuStatus(i+1); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|