微信小程序 bindtap 事件怎么获取当前点击标签

微信小程序 bindtap 事件怎么获取当前点击标签
event.currentTarget 没用

阅读 5.5k
1 个回答

在bindtap的响应函数里,要声明 event 参数,然后会返回大概如下结构的event:

{
"type":"tap",
"timeStamp":895,
"target": {
  "id": "tapTest",
  "dataset":  {
    "hi":"WeChat"
  }
},
"currentTarget":  {
  "id": "tapTest",
  "dataset": {
    "hi":"WeChat"
  }
},
"detail": {
  "x":53,
  "y":14
},
"touches":[{
  "identifier":0,
  "pageX":53,
  "pageY":14,
  "clientX":53,
  "clientY":14
}],
"changedTouches":[{
  "identifier":0,
  "pageX":53,
  "pageY":14,
  "clientX":53,
  "clientY":14
}]
}
推荐问题