SoFunction
Updated on 2025-03-02

Dynamic loading data instance code of WeChat applet

There are a lot of things that have just come out of the WeChat mini program. Let’s write some of the work you want to do at the beginning.

1. First, you need to write a global variable in js

data: {
  datalist: []
 },

2. Request data loading to obtain the entire array information 

 ({
   url: httpUrl,
   data: {},
   success: function (res) {
    ({
     datalist: 
    })
   },

3. Call in .wxml

The call to the array:wx:for="{{datalist}}"

Single variable call in an array:{{}}

Calling calls to a single variable with a domain name in the array: {{}}

Finally, complete the loading of the entire dynamic data! ! ! ! ! ! ! ! ! ! ! ! ! !

Thank you for reading, I hope it can help you. Thank you for your support for this site!