1.在pages.json中设置navigationStyle为custom
{
"path": "pages/views/index",
"style": {
"navigationBarTitleText": "首页",
"navigationStyle": "custom"
}
},
2.非H5端,手机顶部状态栏区域会被页面内容覆盖。这是因为窗体是沉浸式的原因,即全屏可写内容。uni-app提供了状态栏高度的css变量–status-bar-height,如果需要把状态栏的位置从前景部分让出来,可写一个占位div,高度设为css变量。
<template>
<view>
<view class="status_bar"></view>
<view class="customContent"> 自定义导航内容</view>
</view>
</template>
<style>
.status_bar {
height: var(--status-bar-height);
width: 100%;
position: fixed;
top: 0;
background: #fff;
z-index: 998;
}
.customContent {
position: fixed;
height: 88rpx;
background: #fff;
top:var(--status-bar-height);
// padding:50rpx 0 0rpx;
width: 100%;
z-index: 998;
border-bottom: 2rpx solid #eee;
}
</style>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。