微信小程序剛出來有很多的東西還在更新,先寫些剛開始要做的工作
1、首先要寫在js里定義一個(gè)全局變量
data: { datalist: [] },2、請(qǐng)求數(shù)據(jù)加載,獲得整個(gè)數(shù)組信息
wx.request({ url: httpUrl, data: {}, success: function (res) { that.setData({ datalist: res.data.courses }) }, 3、在.wxml中調(diào)用
數(shù)組的調(diào)用用:wx:for="{{datalist}}"
數(shù)組中的單個(gè)變量調(diào)用用:{{item.courseTitle}}
數(shù)組中有域名的單個(gè)變量的調(diào)用用:https://360fast-edu.com{{item.pictureUrl}}
最后完成整個(gè)動(dòng)態(tài)數(shù)據(jù)的加載!!!!!!!!!!!!!!
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注