微信小程序开发双重for循环, wx: if else 语法

微信小程序开发 双重for循环 (多重for循环)

重点在于 wx:for-item="problemItem" 和 wx:for-index="idx" 确定循环的 item 和index
理论上可以实现无上线条循环 ( 没有测试过 )
项目紧张小计一下

( 每天加班到10点, 周六周日全上班, 头发掉光光嘿嘿嘿 )

for循环

<view class="proBlemList">
        <view class="proBlemCard"  wx:for="{{problemList}}" wx:key="index">
            <view class="proBlemName">
                {{item.name}}、
            </view>
            <view class="proBlemItemBox">
                <view class="proBlemItems" >
                    <view  data-type="normal"  bindtap="clickProblemItem" class="proBlemItem {{problemItem.current ? 'current' :''}}" wx:for="{{item.itemList}}" wx:for-item="problemItem" wx:for-index="idx" wx:key="idx">{{problemItem.name}}</view>
                </view>
            </view>
        </view>
    </view>

if else 语法

				<view wx:if="{{ item.timeState == 1}}" class="upload">
                    somedom....
                </view>
                <view wx:elif="{{ item.timeState == 2}}" class="outTime">
                    考试已结束
                </view>
                <view wx:else class="outTime">
                    时间未到
                </view>

版权声明:本文为lxw_hk2_zy原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。