欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

for循环渲染时点击加样式(单个)

程序员文章站 2022-07-14 22:54:49
...
 <block wx:for="{{commentContent}}" wx:for-index="comNum" wx:for-item="comItem">

                <view class="commentContent">
                        <image class="commentHead" src="{{comItem.imgHead}}" mode='aspectFit' lazy-load="false" />
                        <text class="commentTel">{{comItem.tel}}</text>
                        <view class="contentText">{{comItem.content}}</view>
                        <image wx:if="{{comItem.images}}" class="commentPhoto" src="{{comItem.images}}" mode='aspectFit'></image>
                        <view class="commentBotten" hover-class="none" hover-stop-propagation="false">
                                <view class="commentDate" hover-class="none" hover-stop-propagation="false">
                                        {{comItem.date}}
                                </view>
                                <block wx:if="{{comindex==comNum}}">
                                        <view bindtap='zanClick' data-index="{{comItem}}" class="commentZan yizan"
                                                hover-class="none" hover-stop-propagation="false">
                                                <image class="" src="../../images/yizan.png" mode="aspectFit" lazy-load="false"
                                                        binderror="" bindload="" />
                                                <text class="">{{comItem.zanNum}}</text>
                                        </view>
                                </block>
                                <block wx:else>
                                        <view bindtap='zanClick' data-index="{{comNum}}" class="commentZan zan"
                                                hover-class="none" hover-stop-propagation="false">
                                                <image class="" src="../../images/zan.png" mode="aspectFit" lazy-load="false"
                                                        binderror="" bindload="" />
                                                <text class="">{{comItem.zanNum}}</text>
                                        </view>
                                </block>




                        </view>
                </view>
        </block>