1.數據的設置和遍歷
onLoad: function (options) { var datas=[ {image:'/images/post/crab.png'}, {image:'/images/post/crab.png'} ] this.setData({ datas: datas}); }, /***遍歷數據**/ <block wx:for="{{datas}}" wx:for-item="item"> <view class="post-container" > <text>Nov 18 2016</text> </view> <text class='post-title'>正是蝦肥</text> <image class="post-image" src="{{item.image}}"></image> <text class="post-content">哈哈大閘蟹</text> </block>
數據設置
3.頁面跳轉和設置導航標題
頁面跳轉
先添加點擊事件 <view class='moto-container' bindtap='onTap' > onTap:function(){ wx.redirectTo({ url: '../posts/post' }) }
導航標題