Open YinTieShen opened 3 years ago
有没有人啊,复现直接看仓库
taro版本不超过3.0.22
( 超过了则无效),可以使用如下方式:
const onInfoClick = (e: any) => {
e.preventDefault();
e.stopPropagation();
};
兄弟, 试下 handleDebug = (flag = true) => { setTimeout(() => { this.setState({ show: flag }); }, 0); };
兄弟, 试下 handleDebug = (flag = true) => { setTimeout(() => { this.setState({ show: flag }); }, 0); };
嗯嗯,直接阻止冒泡就可以解决,只是感觉这是个bug就提了issue,taro2不存在此问题
这确实是 Taro 的问题导致的,在 3.x 中 react 版本可复现,但是暂时并没有比较好的方法去修复。在 Taro 3.x H5 中没有构建额外的 DOM Tree 去完成事件冒泡的处理,只是借助reactify-wc
实现了事件监听的能力。
目前这个问题暂不考虑修复,组织代码时需尽量避免dom节点增减操作过程中,新增或删除节点上存在关联的冒泡事件监听器这一类情况。
相关平台
H5
复现仓库
https://github.com/YinTieShen/Taro3/blob/main/issue1 浏览器版本: Chrome 62 使用框架: React
复现步骤
期望结果
handleDebug方法冒泡触发了 handleTest方法肯定是错误的
实际结果
handleDebug方法冒泡触发了 handleTest方法
环境信息