【小程序】获取自定义属性

<view bindtap="getDataAttr" data-postId="{{postId}}" data-id="id"  class="div">  
</view>
getDataAttr:function(e){
    console.log(e.currentTarget.dataset.id)
    console.log(e.currentTarget.dataset.postId)
}

猜你喜欢

转载自www.cnblogs.com/xiangbei400G/p/10110117.html
今日推荐