微信小程序--8.关于微信小程序顶部自定义导航栏上下位置偏差的问题

8.关于微信小程序顶部自定义导航栏上下位置偏差的问题

顶部导航栏的结构:

 

已知:
  • 获取系统信息:wx.getSystemInfoSync()
  • 获取胶囊信息:wx.getMenuButtonBoundingClientRect()

 wx.getSystemInfoSync().statusBarHeight;//状态栏高度

 wx.getMenuButtonBoundingClientRect().height;//胶囊高度

 (wx.getMenuButtonBoundingClientRect().top - wx.getSystemInfoSync().statusBarHeight) * 2;//导航栏高度

 

posted @ 2023-10-24 16:08  小那  阅读(140)  评论(0编辑  收藏  举报