微信小程序事件

1、事件的类别

  • 点击事件 tap
  • 长按事件 longtap
  • 触摸事件 touchstart touchend touchmove touchcancel(注:touchcancel是指当用户正在操作触摸时,突然跳出另一个页面例如:来电话,打断了用户的操作,此时触发touchcancel)
  • 其他 submit input

2、事件冒泡

点击子级,也会触发父级事件

<view bindtap="view1Click">
    <view bindtap="view2Click"></view>
</view>

3、事件的绑定

bind绑定

catch绑定(可以阻止冒泡)

<view bindtap="view1Click">
    <view catchtap="view2Click"></view>
</view>
原文地址:https://www.cnblogs.com/strong-FE/p/7095746.html