下面是我的百里香叶标记。声明了一个变量“余额”,该变量应在每次迭代后递减特定数量。
<tbody id="tbody" th:with="balance=${paymentDetails.paymentHead.amount}">
<th:block th:each="invoice_items,i : ${paymentDetails.invoice_amount}">
<tr class="item_row">
<td class="text-center chk">
<input class="chkSelect" th:checked="${balance} gt 0" type="checkbox" style="margin:2px;">
</td>
<p th:with="balance=${balance - invoice_items.balance_amount}"> </p>
<td><input type="text" name="balance[]" style="width: 100%;border:none;background-color: #fff;cursor: default" th:value="${balance}" class="form-control balance text-right" readonly></td>
</tr>
</th:block>
</tbody>