解决优惠券获取链路报错
This commit is contained in:
@@ -750,11 +750,25 @@ export default {
|
||||
},
|
||||
|
||||
scrollToSection(tabKey: string) {
|
||||
const offsets = this.sectionOffsets
|
||||
if (offsets == null) return
|
||||
const offset = offsets.getNumber(tabKey)
|
||||
if (offset != null && offset >= 0) {
|
||||
let target = tabKey == 'goods' ? 0 : Math.max(0, offset - this.customHeaderHeight)
|
||||
const sectionId = 'section-' + tabKey
|
||||
const query = uni.createSelectorQuery()
|
||||
query.select('#' + sectionId).boundingClientRect()
|
||||
query.select('.page-scroll').scrollOffset()
|
||||
query.exec((res: any) => {
|
||||
if (res == null) return
|
||||
let rect: any = null
|
||||
let scrollInfo: any = null
|
||||
if (Array.isArray(res)) {
|
||||
rect = res[0]
|
||||
scrollInfo = res[1]
|
||||
}
|
||||
if (rect == null || rect.top == null) return
|
||||
const nodeTop = rect.top as number
|
||||
const scrollTop = (scrollInfo != null && scrollInfo.scrollTop != null) ? scrollInfo.scrollTop as number : this.currentScrollTop
|
||||
let target = 0
|
||||
if (tabKey != 'goods') {
|
||||
target = Math.max(0, nodeTop + scrollTop - this.customHeaderHeight)
|
||||
}
|
||||
this.isProgrammaticScrolling = true
|
||||
this.targetScrollTop = -1
|
||||
setTimeout(() => {
|
||||
@@ -762,12 +776,12 @@ export default {
|
||||
setTimeout(() => { this.isProgrammaticScrolling = false }, 400)
|
||||
}, 20)
|
||||
this.activeTab = tabKey
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
measureSections() {
|
||||
const sectionIds = ['section-goods', 'section-comments', 'section-detail', 'section-recommend']
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
const query = uni.createSelectorQuery()
|
||||
for (let i = 0; i < sectionIds.length; i++) {
|
||||
query.select('#' + sectionIds[i]).boundingClientRect()
|
||||
}
|
||||
@@ -782,7 +796,6 @@ export default {
|
||||
}
|
||||
}
|
||||
this.sectionOffsets = offsets
|
||||
this.customHeaderHeight = this.statusBarHeight + this.headerMainRowHeight + this.headerTabsRowHeight
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user