参考文章:链接
方式1、 wx.getSystemInfoSync().statusBarHeight
wx.getSystemInfoSync().statusBarHeight
获取的是状态栏的高度,并不是跟右上角的胶囊按钮对齐。
方式2、 wx.getMenuButtonBoundingClientRect()
用 wx.getMenuButtonBoundingClientRect()
官方API可以获取菜单按钮胶囊按钮的布局位置信息。
style绑定内联样式
<template>
<div class="nav