发起请求:
data: {
schooList: [],
},
onLoad: function () {
wx.request({
url: 'XXXXXXX',
method: 'POST',
data: {},
header: {
'content-type': 'application/json'
},
success: res => {
console.log(res.data.result)
this.setData({
schooList: res.data.result,
})
}
})
},
渲染到页面:
<view wx:for="{{schooList:}}" wx:key="index">
<text>{{item.result}}</text>
</view>