关于e.currentTarget.dataset的取值。

wxjs代码:code

GetAction: function (e) {
    var action = e.currentTarget.dataset.action;
    console.log(action); //father
}

 wxml代码:xml

<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的这个值的方法。ip

相关文章
相关标签/搜索