HomeDocs
Skip to main content

NodesRef

Introduction

Node information.

Method Parameters

MethodParametersDescription
boundingClientRectFunction callbackAdds a query request for the layout position of a node relative to the display area (unit: pixels). It functions similarly to getBoundingClientRect in the DOM. The return value is the selectorQuery corresponding to the nodesRef.
fieldsObject fields, Function callbackRetrieves relevant information about a node, with specific fields to be obtained specified in the fields parameter. The return value is the selectorQuery corresponding to the nodesRef.
scrollOffsetFunction callbackAdds a scroll position query request for a node (unit: pixels). The node must be a scroll-view or viewport. The return value is the selectorQuery corresponding to the nodesRef.

Sample Code

Page({
onReady() {
let node = dlt.createSelectorQuery();
// Node's position information, for regular nodes
node.select('node').boundingClientRect((rect) => {});
// Node's relevant information, for regular nodes
node.select('node').scrollOffset().exec();
// Node's scroll position information, for special nodes
node.select('node').fields().exec();
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.