onPostTap: function(e){
var postId = e.currentTarget.dataset.postid;
wx.navigateTo({
url: 'post-detail/post-detail?id='+postId,
})
},
注意navigateto的写法,这是标准的分离ID的写法,至于上面的id,来自于我们在wxml自定义的data属性
<block wx:for="{
{post_key}}" wx:for-item="item">
<view bindtap="onPostTap" data-postid="{
{item.postId}}