js文件onLoad方法内添加:
var that = this wx.request({ url: 'https://qq.ytecn.com/zb/', success: function (res) { that.setData({ zhihu: res.data }) } })
wxml调用方法:
<view class="container log-list"> <block wx:for="{{zhihu.data}}" wx:for-item="log"> <text class="log-item">{{index + 1}}. {{log.title}}</text> </block> </view>