<button bindtap="btn" >Button按钮</button>

 

data:{
name: '名字 '
},
btn(e){
console.log(e.currentTarget.id); // 'hello'
console.log(e.currentTarget.dataset.cnname); '你好' 这里需要注意wxml页面绑定的是cnName,但是获取的时候会转换成小写字母
}

相关文章:

  • 2021-06-06
  • 2021-12-05
  • 2021-09-10
  • 2021-06-13
  • 2021-05-30
  • 2022-12-23
  • 2022-01-03
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案