### 跳轉傳參
`post.js`
~~~javascript
onPostTap:function(event){
var postId = event.currentTarget.dataset.postid;
console.log(postId);
wx.navigateTo({
url: 'post-detail/post-detail?id='+postId,
})
},
~~~
`post-detail.js`
~~~javascript
onLoad: function (options) {
var postId = options.id;
// var postData = postsData.postList[postId];
//console.log(postData);
//this.setData(postData);
},
~~~
### 修改數據源
`posts-data.js`
數據源增加幾個字段
~~~json
{
date: "Sep 18 2016",
title: "正是蝦肥蟹壯時",
imgSrc: "/images/post/crab.png",
avatar: "/images/avatar/1.png",
content: "菊黃蟹正肥,品嘗秋之味。徐志摩把,“看初花的荻蘆”和“到樓外樓吃蟹”,并列為秋天來杭州不能錯過的風雅之事;用林妹妹的話講是“螯封嫩玉雙雙滿,",
reading: "112",
collection: "96",
headImgSrc: "/images/post/crab.png",
author: "林白衣",
dateTime: "24小時前",
detail: "菊黃蟹正肥,品嘗秋之味。徐志摩把“看初花的荻蘆”和“到樓外樓吃蟹”并列為秋天來杭州不能錯過的風雅之事;用林妹妹的話講是“螯封嫩玉雙雙滿,殼凸紅脂塊塊香”;在《世說新語》里,晉畢卓更是感嘆“右手持酒杯,左手持蟹螯,拍浮酒船中,便足了一生矣。”漫漫人生長路,美食與愛豈可辜負?于是作為一個吃貨,突然也很想回味一下屬于我的味蕾記憶。記憶中的秋蟹,是家人的味道,彌漫著濃濃的親情。\n\n是誰來自山川湖海,卻囿于晝夜,廚房與愛? 是母親,深思熟慮,聰明耐心。吃蟹前,總會拿出幾件工具,煞有介事而樂此不疲。告訴我們螃蟹至寒,需要佐以姜茶以祛寒,在配備的米醋小碟里,亦添入姜絲與紫蘇,前者驅寒后者增香。泡好菊花茶,歲月靜好,我們靜等。",
postId: 0
}
~~~
`post-detail.js`
~~~javascript
var postsData = require('../../../data/posts-data.js');
onLoad: function (options) {
var postId = options.id;
var postData = postsData.postList[postId];
console.log(postData);
this.setData(postData);
},
~~~
`post-detail.wxml`
~~~html
<view class="container">
<image class="head-image" src="{{headImgSrc}}"></image>
<image class="audio" src="/images/music/music-start.png"></image>
<view class="author-date">
<image class="avatar" src="{{avatar}}"></image>
<text class="author">{{author}}</text>
<text class="const-text">發表于</text>
<text class="date">{{dateTime}}</text>
</view>
<text class="title">{{title}}</text>
<view class="tool">
<view class="circle-img">
<image src='/images/icon/collection.png'></image>
<image class="share-img" src='/images/icon/share.png'></image>
</view>
<view class="horizon"></view>
</view>
<text class="detail">{{detail}}</text>
</view>
~~~