微信小程序 - wx:for 循环循环中动态的设置变量

查看:1247
本文介绍了微信小程序 - wx:for 循环循环中动态的设置变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

<view wx:for="{{assignmentStudentComments}}" class="reply-area">

<view data-replyto="{{item.assignmentStudent}}" data-index="{{index}}" bindtap="bindReplyTap">
</view>

<view class="flex-comment" hidden="{{????????}}">
    <input type="text" value="{{commentValue}}" class="commentInput" placeholder="{{placeholder}}" data-replyTo="{{commentReply}}" bindconfirm="bindCommentConfirm" bindblur="bindCommentBlur" focus="{{commentFocus}}" confirm-type="send" />
</view>

</view>

在一个循环中,如何设置动态的变量,我要一开始所有的input输入框都是隐藏的,然后点击上面的一个VIEW ,然后显示将对应的input 显示出来, input的hidden变量如何动态的设置? 不考虑把input写在循环外的做法,因为这样不管点击循环中的哪个VIEW都会使INPUT显示在最后,我希望显示在所点击VIEW的下方而不时所有VIEW的最下方

解决方案

<view class="flex-comment" hidden="{{item.isHidden}}">
    <input type="text" value="{{commentValue}}" class="commentInput" placeholder="{{placeholder}}" data-replyTo="{{commentReply}}" bindconfirm="bindCommentConfirm" bindblur="bindCommentBlur" focus="{{commentFocus}}" confirm-type="send" />
</view>

这篇关于微信小程序 - wx:for 循环循环中动态的设置变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆