HomeDocs
Skip to main content

SelectorQuery.exec

Introduction

Executes all the requests, and the results of the requests are formed into an array, which is returned in the first parameter of the callback function.

Parameters

Function callback

Sample Code

Page({
data: {
metrics: [],
},
onReady() {
this.queryNodeInfo();
},
queryNodeInfo() {
const query = dlt.createSelectorQuery();
query.select('.target').boundingClientRect((rect) => {
console.log('Node Information:', rect);
if (rect) {
const metrics = [];
for (const key in rect) {
if (key !== 'id' && key !== 'dataset') {
const val = rect[key];
metrics.push({ key, val });
}
}
this.setData({ metrics });
}
});
query.exec();
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.