dlt.createSelectorQuery
Introduction
Returns a SelectorQuery object instance. You can use methods like select on this instance to select nodes and use methods like boundingClientRect to select the information you want to query.
Parameters
None
Return Value
Sample Code
Page({
data: {
metrics: [],
},
onReady() {
this.queryNodeInfo();
},
queryNodeInfo() {
const query = dlt.createSelectorQuery();
query.select('#the-id').boundingClientRect(function (res) {
res.top; // The top boundary coordinate of the #the-id node (relative to the display area)
});
query.selectViewport().scrollOffset(function (res) {
res.scrollTop; // The vertical scroll position of the display area
});
query.exec();
},
});