From c6cb31ec593deb6b85bd289ae0c2982e952c23a6 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期三, 26 二月 2025 10:16:39 +0800 Subject: [PATCH] fix: bug --- apps/taro/src/stores/modules/system.ts | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/taro/src/stores/modules/system.ts b/apps/taro/src/stores/modules/system.ts index 8c5572f..d19b6a9 100644 --- a/apps/taro/src/stores/modules/system.ts +++ b/apps/taro/src/stores/modules/system.ts @@ -85,20 +85,22 @@ }, setNavigationBarHeight(systemInfo: Taro.getSystemInfoSync.Result) { - const { right, height, width, top } = Taro.getMenuButtonBoundingClientRect(); + try { + const { right, height, width, top } = Taro.getMenuButtonBoundingClientRect(); - let navigationBarHeight = 0; + let navigationBarHeight = 0; - if (systemInfo.platform === 'android') { - navigationBarHeight = 48; - } else { - navigationBarHeight = 44; - } - this.menuButtonHeight = height; - this.menuButtonWidth = width; - this.menuButtonTop = top; - this.menuButtonRightDistance = systemInfo.screenWidth - right; - this.navigationBarHeight = navigationBarHeight; + if (systemInfo.platform === 'android') { + navigationBarHeight = 48; + } else { + navigationBarHeight = 44; + } + this.menuButtonHeight = height; + this.menuButtonWidth = width; + this.menuButtonTop = top; + this.menuButtonRightDistance = systemInfo.screenWidth - right; + this.navigationBarHeight = navigationBarHeight; + } catch (error) {} }, setTabIndex(tabIndex: number) { -- Gitblit v1.9.1