2022/3/2 19:39:45126 閱讀
var that = this; wx.request({ url: 'https://*.*/', //僅為示例,并非真實(shí)的接口地址 data: { id: '1', par: 'news' }, header: { 'content-type': 'application/json' // 默認(rèn)值 }, method: 'post', success(res) { var idata = res.data; that.setData({ par: idata['par'], id: idata['id'], }) }, fail: function (res) { }, complete: function (res) { } })
*.wxml
<view wx:for="{{par}}" wx:for-index="index" wx:for-item="itemName" class="pro_list"> <view class="pro_title"> {{par[index]}} </view> <view class="pro_title"> {{id[index]}} </view> </view>
微信小程序
掃描手機(jī)瀏覽