微信小程序 自定义头部导航栏
.json 文件中加 navigationStyle:custom 顶部导航栏就会消失,只保留右上角胶囊状的按钮,
修改胶囊的颜色:胶囊体目前只支持黑色和白色两种颜色
在.josn 文件中 加上 “navigationBarTextStyle”:“white/black”
自定义导航(返回上一页按钮、返回首页按钮 自定义组件)
wxml:
<view class='nav-wrap' style='height: {
{
height*2 + 20}}px;background:{
{
navbarData.backgroundcolor}}'>
<!-- // 导航栏 中间的标题 -->
<view class='nav-title' style='line-height: {
{
height*2 + 44}}px;'>{
{navbarData.title}}</view>
<view style='display: flex; justify-content: space-around;flex-direction: column'>
<!-- // 导航栏 左上角的返回按钮 和home按钮 -->
<!-- // 其中wx:if='{
{navbarData.showCapsule}}' 是控制左上角按钮的显示隐藏,首页不显示 -->
<view class='nav-capsule' style='height: {
{
height*2 + 44}}px;' wx:if='{
{navbarData.showCapsule}}'>
<!-- //左上角的返回按钮,wx:if='{
{!share}}'空制返回按钮显示 -->
<!-- //从分享进入小程序时 返回上一级按钮不应该存在 -->
<view bindtap='_navback' wx:if='{
{!share}}'>
<image src='/images/goprevico.png' mode='aspectFill' class='back-pre'></image>
</view>
<!-- <view class='navbar-v-line' wx:if='{
{!share}}'></view> -->
<view bindtap='_backhome'>