青春是一种持续的陶醉,是理智的狂热。------拉罗什富科
nvue中@tap.stop阻止冒泡失效了
代码如下:
|-----------|------------------------------------------------------------------------------------------|
| 1 | hljs vue <view @tap="parentEvent"><view @tap.stop="childEvent">触发触发</view></view> |
大概有两种方案,第一种是改事件,改为@touchend事件
|-----------|------------------------------------------------------------------------------------------|
| 1 | hljs vue <view @tap="parentEvent"><view @touchend="childEvent">触发触发</view></view> |
不过还有另一种方式
|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 6 7 | hljs javascript parentEvent(e) { console.log('parentEvent'); }, childEvent(e) { console.log('childEvent'); e.stopPropagation(); } |
51工具盒子