循环得时候当获取到后台传过来的数组为空时,显示暂无数据,但是怎么判断为空?
如果像我这样写会报错
<tr th:each="item:${list.rows}" th:if="${list.rows.lenght>0}">
意思是:属性或字段’size’不能在类型’com.alibaba.fastjson.JSONArray’的对象上找到
应该这样写
<tr th:each="item:${list.rows}" th:if="${#arrays.isEmpty(list.rows)}">
注意:#arrays.isEmpty(list.rows)如果为空 返回true
!#arrays.isEmpty(list.rows)如果为空 返回false
谢谢大家!!!