e.target 拿的是点击的对象的属性

e.currentTarget 则是拿 bintap/catchtap 所在的对象的属性~,点击里面的元素一样能拿到属性值

<view class='a-child' data-tid='{{child.ID}}' bindtap='selectChild'>
  <image class='avatar' src='../../images/localImages/default_user.png'></image>
</view>

selectChild: function(e) {
//获取ID
var tid = e.currentTarget.dataset.tid
console.log('tid: ' + tid)
},

相关文章:

  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-11-07
  • 2021-08-18
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2021-09-20
  • 2021-08-04
  • 2021-11-11
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案