Example of WeChat Apparatus Exercise and Its Blocking Method

This example describes the micro-microbial bubbling event and its blocking method. Share to everyone for reference, specifically:

Category of event is divided into several:

  • Click event : TAP
  • : Longtap
  • Touch event
  • : TouchStart; Touchnd; TouchCancel; TouchMove
  • Other
  • : INPUT; Submit ….
  • The first three categories are bubbling event
  • , other, called
non-spacing event

. Write a simple example, the code is not posted, the WXML file is as follows:

Red

yellow

  The effect is as shown in the figure:      When I click When the innermost blue box, the printed results are as follows:   The mechanism of the bubbling event is to print the click of blue, which is the innermost, The second layer and the third layer are then printed. Suppose you click on the yellow layer, you will print out yellow and red in turn. Click on red only to print red. 
But it can also prevent the occurrence of the bubbling event, which is actually very simple, and bindtap
can be changed to

Catchtap

.

微信小程序冒泡事件及其阻止方法实例分析

Red

yellow

blue

微信小程序冒泡事件及其阻止方法实例分析

You click on the innermost blue, you will only print blue without printing yellow and red. But click yellow or print yellow and red. This time, the yellow page bindtap is changed to

Catchtap
.
  Friendly Tips: Some tags are default in the top, such as Video, want to put a view on Video and set  Catchtap  to cover the VIDEO override.    It is hoped that this article will help the WeChat applet development.                      
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment