themleaf 三元表达式的简单运用
后端传值给mv对象
ModelAndView mv = new ModelAndView();
String isFont = Global.getIsFont();
mv.addObject("indexShow",isFont);
前端使用并接收
<td th:text="${indexShow}=='font'?'系统1':'系统2'"></td>
<div class="col-xs-4" style="padding-top: 6px;font-size:14px">
<span th:if="${sysFileInfo.fileSecret} == 1">公开</span>
<span th:if="${sysFileInfo.fileSecret} == 2">内部</span>
<span th:if="${sysFileInfo.fileSecret} == 3">秘密</span>
<span th:if="${sysFileInfo.fileSecret} == 4">机密</span>
<span th:if="${sysFileInfo.fileSecret} == 5">绝密</span>
</div>
本文来自博客园,作者:xiaolifc,转载请注明原文链接:https://www.cnblogs.com/xiaolibiji/p/16900275.html
浙公网安备 33010602011771号