thymeleaf中双下划线问题
<div th:fragment="foot_menu(index)"> <div class="weui-tabbar wy-foot-menu"> <a href="index.html" th:class="${index}==0?'weui-bar_'+'_item--on weui-tabbar_'+'_item':'weui-tabbar_'+'_item'"> <div class="weui-tabbar__icon foot-menu-home"></div> <p class="weui-tabbar__label">首页</p> </a> <a href="classify.html" class="weui-tabbar__item"> <div class="weui-tabbar__icon foot-menu-list"></div> <p class="weui-tabbar__label">分类</p> </a> </div> </div>
weui中 要求菜单未选中为 class="weui-tabbar__item",选中后为 class="weui-tabbar__item weui-bar__item--on"
错误写法
th:class="${index}==0?'weui-bar__item--on weui-tabbar__item':'weui-tabbar__item'"
正确写法
th:class="${index}==0?'weui-bar_'+'_item--on weui-tabbar_'+'_item':'weui-tabbar_'+'_item'"