wxjs代码:
GetAction: function (e) {
var action = e.currentTarget.dataset.action;
console.log(action); //father
}
wxml代码:
<view data-action="father" bindtap="GetAction">
<image src="https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=1302131682=407" mode="widthFix">
</image>
<text>文字</text>
</view>
这是要获取data-action这个属性的father的这个值的方法。