uni-app的H5端有哪些隐藏原生导航栏的方式
时间: 2024-02-09 12:11:59 浏览: 96
uni-app的H5端可以通过以下方式隐藏原生导航栏:
1. 在页面的 `onLoad` 生命周期中使用 `uni.hideNavigationBarLoading()` 方法来隐藏导航栏。
2. 在页面的 `onShow` 生命周期中使用 `uni.setNavigationBarStyle({navigationBarHidden:true})` 方法来隐藏导航栏。
3. 在 `App.vue` 中设置 `globalStyle`,如下所示:
```html
<style>
/* 隐藏导航栏 */
.uni-page-head {
display: none !important;
}
</style>
```
这样可以全局隐藏导航栏。
4. 在 `manifest.json` 中设置 `h5` 配置,如下所示:
```json
{
"h5": {
"custom": true,
"navigationBarTitleText": "",
"backgroundColor": "#ffffff",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"disableScroll": true
}
}
```
在 `h5` 配置中设置 `custom` 为 `true`,然后设置 `navigationBarTitleText` 为空,这样可以隐藏导航栏。
阅读全文
相关推荐

















