HomeDocs
Skip to main content

dlt.getMenuButtonBoundingClientRect

Introduction

Get the layout information of the menu button (the capsule button in the upper right corner). The coordinate information is based on the upper left corner of the screen.

Usage Limitations

Supported in the base library version 4.0.0 or higher.

Parameters

Object object

PropertyTypeDefaultRequiredDescription
successfunctionNoThe callback function for a successful API call.
failfunctionNoThe callback function for a failed API call.
completefunctionNoThe callback function that is called when the API call ends (whether it succeeds or fails).

object.success Callback Function

Parameters

Object res

PropertyTypeDescription
successstringtrue - Success
widthnumberWidth in pixels
heightnumberHeight in pixels
topnumberTop coordinate in pixels
rightnumberRight coordinate in pixels
bottomnumberBottom coordinate in pixels
leftnumberLeft coordinate in pixels

object.fail Callback Function

Parameters

Object res

PropertyTypeDescription
successstringfalse - Failure

Sample Code

// pages/index/index.js
Page({
getMenuButtonBoundingClientRect() {
dlt.getMenuButtonBoundingClientRect({
success: () => {
console.log('success');
},
});
},
});

In the sample code provided, dlt.getMenuButtonBoundingClientRect is used to retrieve the layout information of the menu button. When the operation is successful, the success callback function is called, and it logs "success" to the console. The layout information includes the width, height, and coordinates (top, right, bottom, left) of the menu button in pixels.

Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.