获取胶囊按钮的宽高,上下左右的距离
const res = wx.getMenuButtonBoundingClientRect()
console.log(res.width) // 宽度
console.log(res.height) // 高度
console.log(res.top) // 上边界坐标
console.log(res.right) // 右边界坐标
console.log(res.bottom) // 下边界坐标
console.log(res.left) // 左边界坐标
结果: