How to prevent bubbling events in the WeChat applet?

In the WeChat applet, when the two contained views use the bindtap function to bind the click event, a bubbling event will occur (that is, when the internal event is clicked, the external event will be triggered at the same time), if we want to prevent bubbling When an event occurs, the bindtap that will be included inside should be a catchtap. Please see the specific examples below.

As shown in the figure below, the click event bound to the red box part can jump to the product details page of the store, and the click event bound to the arrow icon in the green box part jumps to the map navigation page. At this time, we need to prevent it from appearing Bubble events.
Then use bindtap for the click event that jumps to the product details page of the store, and catchtap for the click event that jumps to the map navigation page, which easily prevents the bubbling event of the applet.

Guess you like

Origin blog.csdn.net/weixin_44266024/article/details/128715236