Home  >  Article  >  WeChat Applet  >  A case study of WeChat applet implementing foreground loop data binding

A case study of WeChat applet implementing foreground loop data binding

黄舟
黄舟Original
2017-09-12 09:36:042600browse

This article mainly introduces the relevant information about the front-end loop data binding of the WeChat applet. Here are examples to help you learn and understand this part of the content. Friends in need can refer to it

WeChat applet Program front-end loop data binding

WeChat applet loop data binding to wxml example:

wxml:


 <view wx:for="{{array}}">

  {{item.message}}
  
 </view>

You can bind an array through the above wx.for. The array is of json type; the default index number is item, so use {{item.message}}

to display In data js:


data: {
   array: [
  {
  "message": "foot",
  "txt": "123"
  },
  {
  "message": "bar"
  }]
},

The above json array can loop through the method in wxml to output the array data

The above is the detailed content of A case study of WeChat applet implementing foreground loop data binding. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn