|
@@ -1388,17 +1388,17 @@ export default {
|
|
|
},
|
|
|
navTabClick(index) {
|
|
|
const cellItems = document.querySelectorAll('.more-filter-item')
|
|
|
- // const scrollEle = document.querySelector('.scroll-nav-right')
|
|
|
- // let total = cellItems[index].offsetTop
|
|
|
- // scrollEle.scrollTop = total
|
|
|
+ const scrollEle = document.querySelector('.scroll-nav-right')
|
|
|
+ let total = cellItems[index].offsetTop
|
|
|
+ scrollEle.scrollTop = total
|
|
|
this.markClickScroll = true
|
|
|
- cellItems[index].scrollIntoView({ behavior: 'smooth' })
|
|
|
- // 动画默认都是500ms 所以这里设置大于500ms 延时
|
|
|
+ // cellItems[index].scrollIntoView({ behavior: 'smooth' })
|
|
|
setTimeout(() => {
|
|
|
this.markClickScroll = false
|
|
|
- }, 800)
|
|
|
+ }, 300)
|
|
|
},
|
|
|
handleScroll: throttle(function () {
|
|
|
+ console.log(this.markClickScroll, 'scroll')
|
|
|
if (this.markClickScroll) return
|
|
|
const cellItems = document.querySelectorAll('.more-filter-item')
|
|
|
const offsetTopArr = []
|
|
@@ -1408,7 +1408,7 @@ export default {
|
|
|
const scrollTop = document.querySelector('.scroll-nav-right')?.scrollTop
|
|
|
let navIndex = 0
|
|
|
for (let index = 0; index < offsetTopArr.length; index++) {
|
|
|
- if (scrollTop >= offsetTopArr[index]) {
|
|
|
+ if (scrollTop >= offsetTopArr[index] - 20) {
|
|
|
navIndex = index
|
|
|
}
|
|
|
}
|