|  | @@ -47,20 +47,27 @@ defineProps({
 | 
	
		
			
				|  |  |  const defaultLogoHeight = 40
 | 
	
		
			
				|  |  |  const navbarHeight = ref(0)
 | 
	
		
			
				|  |  |  const statusBarHeight = ref(0)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  onLoad(() => {
 | 
	
		
			
				|  |  | -  const systemInfo = uni.getSystemInfoSync()
 | 
	
		
			
				|  |  | -  statusBarHeight.value = systemInfo.statusBarHeight
 | 
	
		
			
				|  |  | -  const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
 | 
	
		
			
				|  |  | -  navbarHeight.value = menuButtonInfo.height + ((menuButtonInfo.top - statusBarHeight.value) * 2) + 15
 | 
	
		
			
				|  |  | +  try {
 | 
	
		
			
				|  |  | +    const systemInfo = uni.getSystemInfoSync()
 | 
	
		
			
				|  |  | +    statusBarHeight.value = systemInfo.statusBarHeight
 | 
	
		
			
				|  |  | +    const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    // 计算导航栏高度
 | 
	
		
			
				|  |  | +    navbarHeight.value = menuButtonInfo.height + 2 * (menuButtonInfo.top - statusBarHeight.value) + statusBarHeight.value
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  // 将navbarHeight存入本地缓存
 | 
	
		
			
				|  |  | -  const height = navbarHeight.value < defaultLogoHeight ? (defaultLogoHeight + 10) : navbarHeight.value + 10
 | 
	
		
			
				|  |  | -  uni.setStorageSync('navbarHeight', height || 65)
 | 
	
		
			
				|  |  | -})
 | 
	
		
			
				|  |  | +    // 确保导航栏高度不小于 logo 高度 + 10
 | 
	
		
			
				|  |  | +    if (navbarHeight.value < defaultLogoHeight + 10) {
 | 
	
		
			
				|  |  | +      navbarHeight.value = defaultLogoHeight + 10
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -defineExpose({
 | 
	
		
			
				|  |  | -  height: navbarHeight.value < defaultLogoHeight ? (defaultLogoHeight + 10) : navbarHeight.value + 10
 | 
	
		
			
				|  |  | +    // 将 navbarHeight 存入本地缓存
 | 
	
		
			
				|  |  | +    const height = navbarHeight.value < defaultLogoHeight ? (defaultLogoHeight + 10) : navbarHeight.value + 10
 | 
	
		
			
				|  |  | +    uni.setStorageSync('navbarHeight', height)
 | 
	
		
			
				|  |  | +  } catch (error) {
 | 
	
		
			
				|  |  | +    console.error('获取系统信息或菜单按钮信息时出错:', error)
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 |