代码拉取完成,页面将自动刷新
问题描述:
uv-index-list 组件上方还有其他元素时候, 设置了 customNavHeight 后,锚点定位位置偏移。
问题原因:
查看了uv-index-list 源码,微信小程序使用的是 scrollTop 进行锚点定位,取的是 children 的 top,但是 uv-index-list 上面有其他元素时,children 的 top 应该是需要减去 uv-index-list 上方元素的的高度,也就是需要减去 customNavHeight 才能准确的定位锚点。
我这边测试在 uv-index-list 组件的第 319 行代码中,加上 减 this.customNavHeight 后,就能正常了
this.scrollTop = this.children[currentIndex].top - this.customNavHeight;