1. 判断字段是否存在(后台是否返回该字段)

th:if=”${data.containsKey(‘details’)}”

<table class="layui-table" th:if="${data.containsKey('details')}">
    <thead>
        <tr>
            <th>序号</th>
            <th>检验项目</th>
            <th>检验结果</th>
        </tr>
    </thead>
    <tr th:each="checkRecordResult,infoStat : ${data.details}">
        <td>[[${infoStat.index + 1}]]</td>
        <td>[[${checkRecordResult.result_name}]]</td>
        <td>[[${checkRecordResult.result_value}]]</td>
    </tr>
</table>
  1. 判断字段是否为null

th:if=”${data.details!=null}”


版权声明:本文为sinat_36279113原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/sinat_36279113/article/details/128545634