微信小程序通过api接口将json数据展现-微信小程序api接口调用-微信小程序ibeacon
1.
轮播图
viewswiperindicator-dots"{{indicatorDots}}"autoplay"{{autoplay}}"class"banners"interval"{{interval}}"duration"{{duration}}"blockwx:for"{{zhihu}}"wx:key"id"swiper-itemclass"banner"imagesrc"{{item.images}}"data-id"{{item.b}}"bindtap"bindViewTap"class"banner-image"width"100%"height"100%"/textclass"banner-title"{{item.title}}/texttext{{item.ga_prefix}}/text/swiper-item/block/swiper/viewviewclass"type-container"scroll-viewclass"type-navbar"scroll-x"true"viewclass"type-box"wx:for-items"{{zhuxin}}"wx:key"id"viewid"{{item.id}}"class"type-navbar-item"bindtap"tabClick"{{item.name}}/view/view/scroll-view/view//pages/classroom/classroom.jsPage({/***页面的初始数据*/data:{duration:2000,indicatorDots:true,autoplay:true,interval:3000,loading:false,plain:false,},/***生命周期函数--监听页面加载*/onLoad:function(options){varthatthis//不要漏了这句,很重要wx.request({url:'http://news-at.zhihu.com/api/4/news/latest',headers:{'Content-Type':'application/json'},success:function(res){//将获取到的json数据,存在名字叫zhihu的这个数组中that.setData({zhihu:res.data.stories,//res代表success函数的事件对,data是固定的,stories是是上面json数据中stories})}}),wx.request({url:'http://www.*********.com/mapi_v2/Category/getClassRoomCategories',headers:{'Content-Type':'application/json'},success:function(res){//将获取到的json数据,存在名字叫zhuxin的这个数组中that.setData({zhuxin:res.data,})}})},/***生命周期函数--监听页面初次渲染完成*/onReady:function(){},/***生命周期函数--监听页面显示*/onShow:function(){},/***生命周期函数--监听页面隐藏*/onHide:function(){},/***生命周期函数--监听页面卸载*/onUnload:function(){},/***页面相关事件处理函数--监听用户下拉动作*/onPullDownRefresh:function(){},/***页面上拉触底事件的处理函数*/onReachBottom:function(){},/***用户点击右上角分享*/onShareAppMessage:function(){},})声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

