diff --git a/pages/CSS/overflow/overflow-visible-event.uvue b/pages/CSS/overflow/overflow-visible-event.uvue index 6b08d69f16c478f3a79c69029fe62b8422a9eb5d..d9854339cc23ebf328a1cd30f1427b9661b3dff5 100644 --- a/pages/CSS/overflow/overflow-visible-event.uvue +++ b/pages/CSS/overflow/overflow-visible-event.uvue @@ -97,8 +97,8 @@ this.jest_result = true; } }, - jest_getRect() { - const rect = uni.getElementById('child')?.getBoundingClientRect() + async jest_getRect() { + const rect = await uni.getElementById('child')!.getBoundingClientRectAsync() if (rect != null) { let ratio = 1 if (uni.getSystemInfoSync().platform == 'android'){ @@ -120,8 +120,8 @@ this.jest_parent_top = Math.round((parseFloat(value) * ratio)) } }, - jest_getAbsoluteViewRect() { - const rect = uni.getElementById('absolute-view')?.getBoundingClientRect() + async jest_getAbsoluteViewRect() { + const rect = await uni.getElementById('absolute-view')!.getBoundingClientRectAsync() if (rect != null) { const systemInfo = uni.getSystemInfoSync() const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight @@ -133,9 +133,9 @@ this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30 } }, - jest_scrollToDeepOverflow() { + async jest_scrollToDeepOverflow() { const scrollView = uni.getElementById('scroll-view') as UniScrollViewElement - const rect = uni.getElementById('deep-overflow')?.getBoundingClientRect() + const rect = await uni.getElementById('deep-overflow')!.getBoundingClientRectAsync() if (rect != null) { scrollView.scrollTo(0, rect.top) setTimeout(() => { @@ -145,11 +145,12 @@ ratio = uni.getSystemInfoSync().devicePixelRatio } const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight - const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect() - if (afterRect != null) { - this.jest_click_x = afterRect.x * ratio + 30 - this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30 - } + uni.getElementById('deep-overflow')!.getBoundingClientRectAsync().then((afterRect: DOMRect) => { + if (afterRect != null) { + this.jest_click_x = afterRect.x * ratio + 30 + this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30 + } + }) }, 200) } } diff --git a/pages/template/navbar-lite/navbar-lite.uvue b/pages/template/navbar-lite/navbar-lite.uvue index 5b2f78605b84520ea2c953417a10c27acb8a2cf0..c71f9b6d849c90940d0edf064bf583e11de3d228 100644 --- a/pages/template/navbar-lite/navbar-lite.uvue +++ b/pages/template/navbar-lite/navbar-lite.uvue @@ -120,7 +120,7 @@ async calcInputRemainHeight() { let windowHeight = uni.getWindowInfo().windowHeight const rect = await uni.getElementById('input')!.getBoundingClientRectAsync() - this.inputRemainHeight = windowHeight - rect.bottom ?? windowHeight + this.inputRemainHeight = windowHeight - rect.bottom } }, onReady() {