SelectorQuery.selectViewport
Introduction
Selects the display area and can be used to obtain information such as the size and scroll position of the display area. It returns a NodesRef
object instance.
Parameters
None
Return Value
Sample Code
Page({
selectViewport() {
dlt
.createSelectorQuery()
.selectViewport()
.scrollOffset((res) => {
console.log('Node Information:', res);
// res.id // Node's ID
// res.dataset // Node's dataset
// res.scrollLeft // Node's horizontal scroll position
// res.scrollTop // Node's vertical scroll position
})
.exec();
},
});