欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序  網(wǎng)絡(luò)請(qǐng)求API詳解

 更新時(shí)間:2016年10月25日 09:48:59   投稿:lqh  
這篇文章主要介紹了微信小程序 網(wǎng)絡(luò)請(qǐng)求API詳解的相關(guān)資料,需要的朋友可以參考下

wx.request(OBJECT)發(fā)起的是https請(qǐng)求。一個(gè)微信小程序,同時(shí)只能有5個(gè)網(wǎng)絡(luò)請(qǐng)求連接。

OBJECT參數(shù)說明:

 效果圖:

 net.js

Page({
 data:{
  result:{},
 },
 onLoad:function(options){
  this.getDate('http://baobab.wandoujia.com/api/v2/feed?num=2');
 },
 /**
  * 網(wǎng)絡(luò)請(qǐng)求的函數(shù):接收一個(gè)URL參數(shù)
  */
 getDate:function(URL){
    var that = this; 
    // 申請(qǐng)一個(gè)網(wǎng)絡(luò)請(qǐng)求
      wx.request({
    url:URL,
    method:'GET',
   //添加data
   // data: {
   //  x: '',
   //  y: ''
   //  },
   //添加頭信息
   // header: {
   //  'Content-Type': 'application/json'
   // },
    // 請(qǐng)求成功的回調(diào)
    success: function(res) {
      that.setData({
        result:res.data
      })
      console.log(res.data)
    }
    })
 },
})

net.wxml:

<block wx:for-items="{{result.issueList}}">
  <Text style="color:green;">第{{index+1}}個(gè)列表</Text>
  <block wx:for-items="{{item.itemList}}">
     <image style="width:100%;height:200px;" src="{{item.data.cover.feed}}"></image>
  </block>
</block>

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論