微信小程序——获取所有资讯接口数据
生活随笔
收集整理的這篇文章主要介紹了
微信小程序——获取所有资讯接口数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先獲取數據把數據打印出來
接口文檔
第一現在app.js 賦值 如:
app.js文件
index.js文件
onLoad:function(){// 生命周期函數--監聽頁面加載 //'?page=0'+'&size=5' 展示前五條 var zix_data= app.globalData.zixu_url+'?page=0'+'&size=5';this.getMovieListData(zix_data)// console.log(postList)} getMovieListData: function (url) {var that = this;wx.request({url: url,method: 'post', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECTheader: {'content-type': 'application/json'},success: function (res) {that.setData({postList:res.data.objects,}););}},fail: function (error) {// failconsole.log(error)}})}
index.wxml文件
<!--pages/index/index.wxml--> <import src="zix-template/zix-template.wxml" /> <!--<import src="/pages/posts/post-item/post-item-template.wxml" />--><scroll-view class='container' bindscrolltolower="lower" scroll-x='true' scroll-y='true'><block wx:for="{{postList}}" wx:for-item="item" ><!--//template--><view "><view class='zix_template'><image class='zix_img' src="{{coverImage}}"></image><text class='zix_tilte'>{{title}} </text></view></view></block> </scroll-view>本人只是為了個人技術回顧
第二節 如何下滑加載指定的數量數據
第三節 跳轉詳情頁面的跳轉
第四節 詳情頁面評論和 評論時間的轉換遍歷展示
總結
以上是生活随笔為你收集整理的微信小程序——获取所有资讯接口数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: DataV 支持 token 验证啦!
- 下一篇: 怎样才不浪费IP的价值?