两者有点击目标事件的区别,代码如下
<view bindtap='del' data-id="1">
A
<view data-id="2">B</view>
<view>C</view>
</view>
del(e){
console.log('currentTarget:',e.currentTarget.dataset.id)
console.log('target:', e.target.dataset.id)
},
点击A
currentTarget: 1
target: 1
点击B
currentTarget: 1
target: 2
点击C
currentTarget: 1
target: undefined
由上可以看出,currentTarget是冒泡事件,所有内部点击触发
网友评论