微信小程式的事件繫結
阿新 • • 發佈:2020-12-22
微信小程式的事件繫結
</h1>
<div class="clear"></div>
<div class="postBody">
</h1>
<div class="clear"></div>
<div class="postBody">
事件型別
tap touchstart touchmove touchcancel touchend longtap longpress
transitionend animationstart animationiteration animationendtouchforcechange
各種繫結事件方式的區別:
1. bind: 普通繫結(事件會冒泡)
2. catch: 阻止事件冒泡
3. capture-bind: 捕獲階段繫結(後續捕獲流程和冒泡流程會繼續執行)
4. capture-catch: 中斷捕獲階段和取消冒泡階段,在捕獲階段阻止事件的傳遞
三層都以bind的方式繫結,點選第二層,出現冒泡:
將第二層以catch的方式繫結事件,點選第二層,會阻止冒泡:
三層都以capture-bind的方式繫結,點選第三層:
三層都以capture-catch的方式繫結,點選第三層: