0
点赞
收藏
分享

微信扫一扫

小程序获取接口数据

凌得涂 2022-01-20 阅读 66

发起请求:

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>

 

举报

相关推荐

0 条评论