1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | var postData=require( '../../data/posts-data.js' ) Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this .setData({ post_key: postData.postlist }); }, }) var post_container = [ { date: "Nov 25 2016" , title: "正是虾肥蟹壮时" , image: "/imges/avatar/1.png" , crab: "/imges/post/crab.png" , content: "透过阳台玻璃,整个唐岛湾滨海公园尽收眼底。摆在你面前的是各种海鲜美味:清蒸扇贝、拌海蜇、鲜鱼饼子、烤海捕大虾、梭子蟹……“" , coll: "92" , view: "68" , }, { date: "Nov 25 2016" , title: "正是虾肥蟹壮时" , image: "/imges/avatar/2.png" , crab: "/imges/post/bl.png" , content: "透过阳台玻璃,整个唐岛湾滨海公园尽收眼底。摆在你面前的是各种海鲜美味:清蒸扇贝、拌海蜇、鲜鱼饼子、烤海捕大虾、梭子蟹……“" , coll: "92" , view: "68" , }, { date: "Nov 25 2016" , title: "正是虾肥蟹壮时" , image: "/imges/avatar/3.png" , crab: "/imges/post/cat.png" , content: "透过阳台玻璃,整个唐岛湾滨海公园尽收眼底。摆在你面前的是各种海鲜美味:清蒸扇贝、拌海蜇、鲜鱼饼子、烤海捕大虾、梭子蟹……“" , coll: "92" , view: "68" , }, { date: "Nov 25 2016" , title: "正是虾肥蟹壮时" , image: "/imges/avatar/3.png" , crab: "/imges/post/sls.JPG" , content: "透过阳台玻璃,整个唐岛湾滨海公园尽收眼底。摆在你面前的是各种海鲜美味:清蒸扇贝、拌海蜇、鲜鱼饼子、烤海捕大虾、梭子蟹……“" , coll: "92" , view: "68" , } ] module.exposts={ postlist: post_container } <view> <swiper indicator-dots= "true" > <swiper-item> <image src= "/imges/wx.png" ></image> </swiper-item> <swiper-item> <image src= "/imges/vr.png" ></image> </swiper-item> <swiper-item> <image src= "/imges/iqiyi.png" ></image> </swiper-item> </swiper> <block wx: for = "{{post_key}}" wx: for -item= "item" > <view class= "post-container" > <view class= "post-author-date" > <image class= "post-author" src= "{{item.image}}" ></image> <text class= "post-date" >{{item.date}}</text> </view> <text class= "post-title" >{{item.title}}</text> <image class= "post-image" src= "{{item.crab}}" ></image> <text class= "post-content" >{{item.content}}</text> <view class= "post-like" > <image class= "post-like-image" src= "../../imges/icon/chat.png" ></image> <text class= "post-like-font" >{{item.coll}}</text> <image class= "post-like-image" src= "../../imges/icon/view.png" ></image> <text class= "post-like-font" >{{item.view}}</text> </view> </view> </block> </view> |
4年同步微信官方迭代,累计20000+人学习, 比微信官方更火爆!
了解课程