uni-app 在iphone6s ios14.4上无法隐藏tabbar

uni-app 在iphone6s ios14.4上无法隐藏tabbar

开发环境 版本号 项目创建方式
Windows win10 64位操作系统 HBuilderX

产品分类:uniapp/App

PC开发环境操作系统:Windows

HBuilderX类型:正式

HBuilderX版本号:3.1.4

手机系统:iOS

手机系统版本号:IOS 14

手机厂商:苹果

手机机型:iphone6s

页面类型:vue

打包方式:云端

示例代码:

onLaunch: async function() {  
    uni.hideTabBar()  
}

操作步骤:

onLaunch: async function() {  
    uni.hideTabBar()  
}

预期结果:

  • 隐藏tabbar

实际结果:

  • 隐藏失效

bug描述:

  • 更正: 1. ios: 14.4 2. 标准基座真机测试iphone6s 在 onLaunch中使用uni.hideTabBar() 无法隐藏tabbar,h5端有效

更多关于uni-app 在iphone6s ios14.4上无法隐藏tabbar的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于uni-app 在iphone6s ios14.4上无法隐藏tabbar的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这是一个已知的 iOS 兼容性问题。在 onLaunch 生命周期中调用 uni.hideTabBar() 在某些 iOS 版本上可能无法生效,这是因为页面初始化时 TabBar 尚未完全渲染完成。

建议改用以下方案:

  1. onShow 中延迟执行
onShow() {
  setTimeout(() => {
    uni.hideTabBar()
  }, 100)
}
  1. 使用条件渲染: 在 pages.json 中对应页面配置:
{
  "tabBar": {
    "custom": true
  }
}

然后通过自定义组件控制 TabBar 显示状态。

  1. onReady 中执行
onReady() {
  uni.hideTabBar()
}
回到顶部