小程序獲取菜單按鈕的布局位置wx.getMenuButtonBoundingClientRect
Object wx.getMenuButtonBoundingClientRect()
獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標(biāo)信息以屏幕左上角為原點(diǎn)。
返回值
Object
菜單按鈕的布局位置信息
屬性 類型 說明
width number 寬度,單位:px
height number 高度,單位:px
top number 上邊界坐標(biāo),單位:px
right number 右邊界坐標(biāo),單位:px
bottom number 下邊界坐標(biāo),單位:px
left number 左邊界坐標(biāo),單位:px
示例代碼
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)
作者:大學(xué)生新聞網(wǎng) 來源:大學(xué)生新聞網(wǎng)
發(fā)布時(shí)間:2025-04-06 閱讀:
- 小程序開始下拉刷新
- 開始下拉刷新。調(diào)用后觸發(fā)下拉刷新動(dòng)畫,效果與用戶手動(dòng)下拉刷新一致。
- 04-06 關(guān)注:0