html - thymeleaf 中的嵌套迭代无法正常工作
问题描述
我正在尝试为电影院大厅建立座位选择视图。我设法从 Arraylist 中迭代对象,但 row_iterator 在第 3 行卡在 0 处,我在其中设置了 top position <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>
解决方案
推荐阅读
- java - JAVAFX SortedList 不排序。(并使其破坏列排序。)
- c++ - 为什么 std::valarray 没有 std::data() 重载?
- android - 设置自定义背景颜色时,浮动操作按钮背景颜色在禁用时不会更改
- html - 来自 HtmlWeb 的 HTMLAgilityPack 缺少 HTML 节点
- blockchain - 无法在节点和运行时之间转换参数“tx”:解码字段 CheckMortality.0 时出错
- sql - 选择多个 PRIMARY KEY
- javascript - 指数数字格式化程序 - javascript
- php - PHP - SimpleXMLElement - 如何访问此元素
- sql - 将列从 BigInt 转换为 DateTime
- javascript - 使用 useState 钩子将新对象推送到子对象数组