This time I will bring you the difference between wx:for and wx:for-item in the WeChat mini program. What are the things to note when using wx:for and wx:for-item in the WeChat mini program? There are Which ones, the following are practical cases, let’s take a look.
wx:for="{{list}}" is used to loop the
array, and list is the array namewx:for-item=" items" is used to define the
variable of each element during a loop. If it is a one-dimensional array
<view wx:for="{{list}}"> {{index}} {{item.name}} </view>
multi-dimensional array
, loop as follows:<view wx:for="{{parentList}}"> {{item.id}} <view wx:for="{{item.childList}}" wx:for-item="items"> {{items.name}}{{item.account}} </view> </view> for (var i = 0 ; i < list.length; i++) { var xxx = list[i]; }
<view wx:for="{{list}}" wx:for-item="xxx"></view>
<view wx:for-item="{{list}}"> {{index}} {{item.name}} </view>
<view wx:for="{{parentList}}"> {{item.id}} <view wx:for-item="{{item.childList}}" wx:for-item="items"> {{items.name}}{{items.account}} </view>
<view wx:for="{{list}}"> {{index}} {{item.name}} </view>
<view wx:for="{{parentList}}"> {{item.id}} <view wx:for="{{item.childList}}" wx:for-item="items"> {{items.name}}{{item.account}} </view> </view> for (var i = 0 ; i < list.length; i++) { var xxx = list[i]; }
<view wx:for="{{list}}" wx:for-item="xxx"></view>
<view wx:for-item="{{list}}"> {{index}} {{item.name}} </view>
<view wx:for="{{parentList}}"> {{item.id}} <view wx:for-item="{{item.childList}}" wx:for-item="items"> {{items.name}}{{items.account}} </view>
I believe you have mastered the method after reading the case in this article. Please pay attention for more exciting things. Other related articles on php Chinese website!
Recommended reading:How to deal with vue axios request timeout
axios login request interceptor
The above is the detailed content of What is the difference between wx:for and wx:for-item in WeChat mini program?. For more information, please follow other related articles on the PHP Chinese website!