button如何阻止冒泡?
bind和catch可以处理冒泡,但比如调起分享的时候要必须用button open-type="share"完成,不能绑定事件,这种情况如何阻止冒泡?
bind和catch可以处理冒泡,但比如调起分享的时候要必须用button open-type="share"完成,不能绑定事件,这种情况如何阻止冒泡?
open-type="share"也可以catchtap的~~
也会执行的。不冲突
<button open-type="share" catchtap="csss">转发给好友</button>
csss:function (e) {
console.log("e",e);
}
<view bindtap="func1">
<button open-type="share" catchtap="func2">分享</button>
</view>
=============================
func1(e) {
console.log('view')
},
func2(e) {
console.log('button')
}
只会触发func2,不会触发func1,因为func2是catch,已阻止冒泡到func1
分享功能不受影响,其实func2定不定义都没事
若认为该回答有用,给回答者点个[ 有用 ],让答案帮助更多的人