微信小程序自定义属性设置和获取

 <block wx:for='{{post_key}}' wx:key="key" wx:for-item='item'>
    <view catchtap='onPostTap' data-post>
      <template is='postItem' data='{{...item}}' />
    </view>
  </block>
  1. let postId=event.currentTarget.dataset.postid;

  2. console.log(postId);