我想这样做:
<div th:text="${abc.tempLow != null} ? ${abc.tempLow + '°C '}"></div> <div th:text="${abc.tempHigh != null} ? ${abc.tempHigh + '°C '}"></div>
但在一个分区里,这样的事情是行不通的:
<div th:text="${abc.tempLow != null} ? ${abc.tempLow + '°C '} + ${abc.tempHigh() != null} ? ${abc.tempHigh + '°C'}"></div>
有可能吗?谢谢。
就这样做:
<div> <th:block th:text="${abc.tempLow != null ? abc.tempLow + '°C ' : ''}">tempLow</th:block> <th:block th:text="${abc.tempHigh != null ? abc.tempHigh + '°C ' : ''}">tempHigh</th:block> </div>