微信小程序bindTap获取对应值

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

data:{

name: '名字 '

},

btn(e){

console.log(e.currentTarget.id); // 'hello'

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

}