Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to obtain the relevant information of nodes in Mini Program development

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to get node-related information in Mini Program development". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Mini Program development how to get node-related information" it!

To get the relevant information about the node, the fields to be obtained are specified in the fields. The return value is the selectorQuery corresponding to nodesRef. The fields that can be specified to get are:

The default value of the field name indicates whether the id returns the node iddataset No whether the node datasetrect returns the node layout location (left right top bottom) size whether the node size (width height) scrollOffset returns the scrollLeft scrollTop of the node, the node must be a scroll-view or viewportproperties [] specified attribute name list, and the current attribute value of the corresponding attribute name of the node is returned (only the general attribute values indicated in the component document can be obtained Property values of id class style and event bindings are not available)

Sample code:

Page ({getFields: function () {wx.createSelectorQuery (). Select ('# the-id'). Fields ({dataset: true, size: true, scrollOffset: true, properties: ['scrollX',' scrollY']]} Function (res) {res.dataset / / Node dataset res.width / / Node width res.height / / Node height res.scrollLeft / / Node horizontal scrolling position res.scrollTop / / Node vertical scrolling position res.scrollX / / Node scroll-x attribute current value res.scrollY / / Node scroll-x attribute Value}) .exec ()}}) so far I believe that "Mini Program development how to get node-related information" have a deeper understanding, might as well to practical operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report