How to load data dynamically by WeChat Mini Programs
Today, the editor will share with you the relevant knowledge about how WeChat Mini Programs dynamically loads data. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
1. The first step is to define a global variable in js
Data: {datalist: []}
2. Request data loading to get the whole array information
Wx.request ({url: httpUrl, data: {}, success: function (res) {that.setData ({datalist: res.data.courses})}
3. Call in .wxml
The array is called with: wx:for= "{{datalist}}"
A single variable in the array is called with: {{item.courseTitle}}
The call to a single variable with a domain name in the array is used: https://360fast-edu.com{{item.pictureUrl}}
Finally, complete the loading of the whole dynamic data!
These are all the contents of the article "how to load data dynamically by WeChat Mini Programs". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.