Home > WeChat Applet > Mini Program Development > How to output a two-dimensional array from a small program

How to output a two-dimensional array from a small program

angryTom
Release: 2020-03-21 11:21:27
Original
7262 people have browsed it

When developing WeChat applet, two-dimensional arrays are needed to display information. So how to output and display the two-dimensional array? Let’s learn together.

How to output a two-dimensional array from a small program

How to output a two-dimensional array from a small program

1. First define a two-dimensional array

Page({  
    data:{
        mapData:[
            [{id:11},{id:12}],
            [{id:21},{id:22}],
            [{id:31},{id:32},{id:33}]
      ]
    }

})
Copy after login

2. Then use two layers of wx:for loops to output.

<view class="container">
    <view class="map">
        <view wx:for="{{mapData}}">
            <view wx:for="{{item}}">
                {{item.id}}
            </view>
        </view>
    </view>
</view>
Copy after login

For more WeChatmini program development tutorials, please pay attention to the PHP Chinese website.

The above is the detailed content of How to output a two-dimensional array from a small program. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template