我正在尝试建立电影院座位选择视图。我设法从Arraylist迭代对象,但row_iterator在第3行中停留在0,在该行中,我设置了最高位置<i>(top: '+(row_iterator.index*20)+'px')</i>
。
在第2行和第6行,迭代器起作用。任何帮助表示赞赏
HTML:
<th:block class="hall__row" th:each="row, row_iterator: ${theater.getRows()}">
<div class="hall__places-row _left" th:attr="data-row=${row.getId()}" th:attrappend="style=${'top: '+(row_iterator.index*20)+'px'}"> </div>
<div class="hall__places-item is-free" th:each="seat, seat_iterator : ${row.getSeats()}" th:attr="data-row=${row.getId()}" data-column="1" data-price-id="1" data-pos-x="1" data-pos-y="12" data-state="free" data-price="40" data-place-size="20" th:attrappend="style=${'left: '+((seat_iterator.index+1)*20)+'px;'+'top: '+(row_iterator.index*20)+'px'}">
<div class="hall__places-chair" th:attr="data-title=${movie.getPrice()}" data-toggle="tooltip" data-placement="top"></div>
</div>
<div class="hall__places-row _right" th:attr="data-row=${row.getId()}" th:attrappend="style=${'top: '+(row_iterator.index*20)+'px'}"> </div>
</th:block>