Compare commits
3 Commits
852ad87465
...
dd243e84da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd243e84da | ||
|
|
d2c0364cbf | ||
|
|
a87a70e057 |
@ -80,7 +80,6 @@
|
||||
this.checkUserInfo()
|
||||
// 当页面显示时,设置tabber的激活项
|
||||
this.$store.commit('setTabbarCurrent', 0)
|
||||
console.log(this.orderList)
|
||||
},
|
||||
methods: {
|
||||
// 检查用户信息
|
||||
|
||||
@ -114,6 +114,9 @@
|
||||
arr: [], //记录 右边菜单每个item到顶部的距离
|
||||
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
|
||||
timer: null, // 定时器
|
||||
|
||||
isScrollingByClick: false, // 添加这个标志 解决点击左侧导航栏点击 右侧内容滚动之后 反过来影响左侧导致跳变
|
||||
scrollingTiemout: null, //timeout对象
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
@ -166,6 +169,8 @@
|
||||
totalPrice,
|
||||
// 点击左边的栏目切换
|
||||
async swichMenu(index) {
|
||||
clearTimeout(this.scrollingTiemout) //每次点击导航栏重置timeout延时
|
||||
this.isScrollingByClick = true
|
||||
if (this.arr.length == 0) {
|
||||
await this.getMenuItemTop()
|
||||
}
|
||||
@ -176,6 +181,9 @@
|
||||
this.current = index
|
||||
this.leftMenuStatus(index)
|
||||
})
|
||||
this.scrollingTiemout = setTimeout(() => {
|
||||
this.isScrollingByClick = false
|
||||
}, 800)
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
@ -262,7 +270,9 @@
|
||||
let height2 = this.arr[i + 1]
|
||||
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
|
||||
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
|
||||
this.leftMenuStatus(i)
|
||||
if (!this.isScrollingByClick) {
|
||||
this.leftMenuStatus(i)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user