数据获取: 注意: 1.服务器要配置https 2.配置合法域名 3.在本地调试,在开发者工具勾选
wx
.request({
url
: '接口地址',
data
: {},
success
: function (res
) {},
fail
:function(err
){}
})
数据渲染:
–js–
onLoad
: function (options
) {
var that
=this;
wx
.request({
url
: 'https://xxxxxxx',
data
: {},--参数
success
: function (res
) {
that
.setData({
shuju
:res
.xxxxx
})
},
fail
: function (err
) {
}
})
}
–wxml–
<block wx:for="{{shuju}}">
<view>{{item.xxx}}
</view>
</block>
转载请注明原文地址: https://yun.8miu.com/read-109652.html