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

What is the event flow in WeChat Mini Programs?

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the event flow in WeChat Mini Programs". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "what is the event flow in WeChat Mini Programs"!

First, what is an event?

Events are the way to communicate from the view layer to the logical layer

Events can feed back the user's behavior to the logical layer for processing.

The event can be bound to the component, and when the event is triggered, the corresponding event handling function in the logic layer is executed.

Event objects can carry additional information.

Second, event model

Events are divided into event capture phase, event bubbling stage and event processing phase.

Properties of the event object:

Type: the type of event triggered

Timestamp: timestamp of the time when the event was triggered

Target: the source component that triggers the event, including the id that triggers the event component, the type, and a collection of dataset custom properties

CurrentTarget: the current component that triggers the event, the id that triggers the current event, the type, and a collection of dataset custom attributes

Touches: a message that indicates that we stay at the touch point on the screen

ChangedTouches: information that represents a changing touchpoint

Detail: indicates the data carried by our bound event, including the distance from XUnix y to the upper left corner of the page

The difference between currentTarget and target

CurrentTarget: represents the current component

Target: root component:

For example, as shown above, the outermost layer is bound with a click event, and the innermost layer is bound with a click event. When you click on the innermost event, target represents the outermost component, and currentTarget represents the innermost component.

III. Types of events

Trapable event

Touchstart 、 tap 、 touchmove 、 longpress 、 touchcancel 、 longtap 、 touchend

Bubbling event

Touchstart longtap 、 touchmove transitionend 、 touchcancel 、 animationstart 、 touchend 、 animationiteration 、 tap 、 animationend 、 longpress touchforcechan. 、

Thank you for your reading. the above is the content of "what is the event flow in WeChat Mini Programs". After the study of this article, I believe you have a deeper understanding of the issue of what the event flow is in WeChat Mini Programs. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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