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

<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)
}
posted @ 2018-12-12 18:27  Orange。  阅读(1143)  评论(0)    收藏  举报