For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/ui/interaction/getMenuButtonBoundingClientRect.md.

getMenuButtonBoundingClientRect

取菜单按钮(右上角胶囊按钮)的布局位置信息。

扫码预览

扫码预览 getMenuButtonBoundingClientRect

支持版本

前端库版本不低于 0.0.26。

支持平台

平台支持情况
Android支持
iOS支持
PC不支持
HarmonyOS不支持

支持场景

场景支持情况
页面支持
卡片不支持

使用说明

  • 坐标单位为逻辑像素,与 CSS 像素一致,可直接用于页面布局定位。

调用方式

同步 API

getMenuButtonBoundingClientRect(): MenuButtonBoundingClientRect

入参

无。

调用示例

import { getMenuButtonBoundingClientRect } from '@doubao-dev/framework/api';

const rect = getMenuButtonBoundingClientRect();

console.log(rect.width, rect.height);
console.log(rect.top, rect.right, rect.bottom, rect.left);

返回值

名称类型必返说明
bottomnumber是下边界坐标,单位 px。
heightnumber是高度,单位 px。
leftnumber是左边界坐标,单位 px。
rightnumber是右边界坐标,单位 px。
topnumber是上边界坐标,单位 px。
widthnumber是宽度,单位 px。

返回示例

{
  "width": 84,
  "height": 36,
  "top": 48,
  "right": 363,
  "bottom": 84,
  "left": 279
}