uni-app开发之自定义导航栏
- 插件市场引入自定义导航栏:NavBar 导航栏
- 路由设置“navigationStyle”,pages.json上设置:
{
"path" : "pages/home/warning/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
- 页面使用
注意:使用自定义导航栏需除去状态栏部分,否则打包成app时状态栏会被遮挡
<view class="status_bar"></view>
<uni-nav-bar left-icon="back" class="nav_bar" fixed="true" backgroundColor="#0280FD" color="#FFFFFF" @clickLeft="reBack">
<view class="cu_bar_title">自定义导航栏</view>
</uni-nav-bar>
// 状态栏的高度
.status_bar {
height: var(--status-bar-height);
}