This article mainly introduces detailed information about the small program for loop. for more information about the small program for loop, see this article.
1, wx:
You can bind an array to the wx: for Control attribute on the component to repeatedly render the component using the data in the array. The subscript variable name of the current item of the default array is index by default, and the variable name of the current item of the array is item by default. The example is as follows:
Wxml file:
{Index }:{{ item: one }}
Js file: Page ({items: [{one: "test1" ,}, {one: "test2"}]})
You can use wx: for-item to specify the variable name of the current element of the array.
You can use wx: for-index to specify the name of the variable under the array. The example is as follows:
Wxml file:
{Id }}:{ name. one }}
The following is an example of a multiplication table:
{I }}* {j }}={ {I * j }}
2, block wx:
Wx: Label to render a structure block containing multiple nodes. For example:
{{index}}:
{{item}}
As follows:
Thank you for reading this article. I hope it will help you. thank you for your support for this site!
The above is a detailed explanation of the for loop of small programs. for more details, please follow other related articles in the first PHP community!