getMenuButtonBoundingClientRectSync
功能描述
获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。的同步版本
需引入
MiniKit
,且在>=2.3.0
版本才可使用
使用
Ray 中使用
import { getMenuButtonBoundingClientRectSync } from '@ray-js/ray'
getMenuButtonBoundingClientRectSync({ ... })
原生小程序中使用
ty.getMenuButtonBoundingClientRectSync({ ... })
返回值
属性 | 类型 | 说明 | 版本 |
---|---|---|---|
width | number | 宽度,单位:px | |
height | number | 高度,单位:px | |
top | number | 上边界坐标,单位:px | |
right | number | 右边界坐标,单位:px | |
bottom | number | 下边界坐标,单位:px | |
left | number | 左边界坐标,单位:px |
代码示例
请求示例
// Ray调用方式
import { getMenuButtonBoundingClientRectSync } from '@ray-js/ray';
// 原生调用方式
const { getMenuButtonBoundingClientRectSync } = ty;
const res = getMenuButtonBoundingClientRectSync();
console.log('getMenuButtonBoundingClientRectSync', res);
成功示例
{
"bottom": 86,
"height": 34,
"left": 318,
"right": 403,
"top": 52,
"width": 85
}
错误码
错误码 | 错误描述 |
---|---|
7 | API Internal processing failed |
此页内容是否对您有帮助?
是
意见反馈