这篇文章主要介绍了微信小程序 网络请求API详解的相关资料,需要的朋友可以参考下
wx.request(OBJECT)发起的是https请求。一个微信小程序,同时只能有5个网络请求连接。
OBJECT参数说明:

效果图:

net.js
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 | Page({
data:{
result:{},
},
onLoad: function (options){
this. getDate ('http:
},
getDate : function (URL){
var that = this;
wx.request({
url:URL,
method:'GET',
success: function (res) {
that.setData({
result:res.data
})
console.log(res.data)
}
})
},
})
|
Salin selepas log masuk
net.wxml:
1 2 3 4 5 6 | <block wx: for -items= "{{result.issueList}}" >
<Text style= "color:green;" >第{{index+1}}个列表</Text>
<block wx: for -items= "{{item.itemList}}" >
<image style= "width:100%;height:200px;" src= "{{item.data.cover.feed}}" ></image>
</block>
</block>
|
Salin selepas log masuk
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
Atas ialah kandungan terperinci 微信小程序之网络请求API详解. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!