- 仅在微信环境下调用Taro.getMenuButtonBoundingClientRect()获取菜单按钮信息 - 非微信环境下将menuButtonInfo设为undefined,避免运行时错误
@@ -24,7 +24,7 @@ export interface NavbarProps {
}
const systemInfo = Taro.getSystemInfoSync()
-const menuButtonInfo = Taro.getMenuButtonBoundingClientRect()
+const menuButtonInfo = isWeapp() ? Taro.getMenuButtonBoundingClientRect() : undefined
// 计算导航栏高度
const NAVBAR_HEIGHT = 44