如何在功能中正确传递${policies.getId()
,同时循环播放${policies}
?
<html>
...
<table>
<thead>
<tr>
<th>id</th>
<th>name</th>
</tr>
</thead>
<tbody>
<tr th:each="policies : ${policies}" >
<td th:object="${policies.getId()}" onload="myFunction01(object)"></td>
<td th:object="${policies.getName()}" onload="myFunction02(object)"></td>
</tr>
</tbody>
</table>
<script th:inline="javascript">
function myFunction01(object){...}
function myFunction02(object){...}
</script>
</html>
答案 0 :(得分:0)
你可以尝试一下,让我知道这是否适合你
th:onload ="'myFunction01(\'' + ${policies.getId()} + '\');'"