|
@@ -81,6 +81,7 @@ export default {
|
|
return height - firstTop
|
|
return height - firstTop
|
|
},
|
|
},
|
|
computedContentTop () {
|
|
computedContentTop () {
|
|
|
|
+ clearTimeout(this.computedTf)
|
|
const query = Taro.createSelectorQuery()
|
|
const query = Taro.createSelectorQuery()
|
|
query.select(`#scroller`).boundingClientRect()
|
|
query.select(`#scroller`).boundingClientRect()
|
|
this.tabs.forEach(item => {
|
|
this.tabs.forEach(item => {
|
|
@@ -92,7 +93,17 @@ export default {
|
|
this.contentClientRects = res
|
|
this.contentClientRects = res
|
|
this.contentScrollTops = tabs.map(ele => {
|
|
this.contentScrollTops = tabs.map(ele => {
|
|
console.log(ele, 'ele')
|
|
console.log(ele, 'ele')
|
|
- return ele.top - scrollerTop.top
|
|
|
|
|
|
+ if (ele) {
|
|
|
|
+ return ele.top - scrollerTop?.top
|
|
|
|
+ } else {
|
|
|
|
+ console.log('未获取 dom')
|
|
|
|
+ this.computedTf = setTimeout(() => {
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.computedContentTop()
|
|
|
|
+ })
|
|
|
|
+ }, 200)
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|