自定义组件bubbles为false时并没有阻止事件冒泡
发布于 5 年前 作者 qianjun 12848 次浏览 来自 问答

给组件自定义事件时,设置bubbles为true和false表现一致,并没有阻止事件冒泡。

this.triggerEvent(‘customevent’,{e},{  });

this.triggerEvent(‘customevent’,{ e }, { bubbles:true });

https://developers.weixin.qq.com/s/QwB5g2mL7D4z

希望只触发 customevent 事件,不触发外层view上绑定的tap事件。

1 回复

使用 triggerEvent 将触发另一个与 tap 无关的独立事件。如果需要阻止 touch 事件冒泡,请使用 catchtap 。

回到顶部