小程序自定义顶部导航栏的样式问题

自定义的导航栏:

app.json:
    "navigationStyle": "custom"
自定义:
    
<!--wxml-->
<view class='header'>
  <view class='flex'>
    今日菜价
  </view>
</view>
<!--wxss-->
.header{
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 114rpx;
  padding: 0;
  padding-top: 40rpx;
  border-bottom: none;
  background-color: #ffffff;
}
.header::after{
  content: "";
  display: inline-block;
  width: 100%;
  height: 40rpx;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: auto;
  background-color: #000000;
}
.header>view{
  width: 100%;
  height: 100%;
  padding: 0 15rpx;
}

自定义效果图一(iphone6):
clipboard.png

自定义效果图二(iphone5):

clipboard.png

产品需求的样式图:
clipboard.png
那个右边的胶囊,位置总是相较于自定义的导航栏乱跑,如何避免?

阅读 4.5k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题