微信小程序自定义属性设置和获取
<block wx:for='{{post_key}}' wx:key="key" wx:for-item='item'> <view catchtap='onPostTap' data-post> <template is='postItem' data='{{...item}}' /> </view> </block>
let postId=event.currentTarget.dataset.postid;
console.log(postId);
<block wx:for='{{post_key}}' wx:key="key" wx:for-item='item'> <view catchtap='onPostTap' data-post> <template is='postItem' data='{{...item}}' /> </view> </block>
let postId=event.currentTarget.dataset.postid;
console.log(postId);