https://blog.youkuaiyun.com/qq_34262794/article/details/80380566
大佬给力
<div class="layui-inline">
<label class="layui-form-label">性别</label>
<div class="layui-input-inline">
<input type="radio" name="sex" value="男" title="男" th:if="${staff.sex ne null}" th:field="${staff.sex}">
<input type="radio" name="sex" value="女" title="女" th:if="${staff.sex ne null}" th:field="${staff.sex}">
<input type="radio" name="sex" value="男" title="男" th:if="${staff.sex eq null}" th:checked="checked">
<input type="radio" name="sex" value="女" title="女" th:if="${staff.sex eq null}">
</div>
</div>
thymeleaf 的方式回显 单选按钮
<div class="layui-input-inline">
<input th:each="item:${statuslist}" type="radio" name="repairstatus" th:value="${item.commondesc}" lay-filter="repairstatus" th:text="${item.commonname}" th:field="*{obj.repairstatus}"/>
</div>
model.addAttribute("obj",MaintenanceinfoService.getinfo(entity));
model.addAttribute("statuslist",commonService.tools("123"));
<select name="fireboxroltype">
<option value="">请选择</option>
<option th:selected="${abc.ficontroltype eq item.name}" th:each="item:${model}"
th:text="${item.name}"
th:value="${item.code}"></option>
</select>
走两个model。 ficontroltype 是查出来的code值。需要 eq 对应上code值。然后好像thymeleaf进行渲染,接着显示对应的name值。----上面的都是动态回显。
来个静态的额。
<select name="comrepairdate2end" lay-filter="aihao">
<option value="">请选择</option>
<option th:selected="${obj.getComrepairdate2end() eq '上午(8:00-11:00)'}" value="上午(8:00-11:00)">上午(8:00-11:00)</option>
<option th:selected="${obj.getComrepairdate2end() eq '下午(1:30-5:00)'}" value="下午(1:30-5:00)">下午(1:30-5:00)</option>
<!-- <option value="上午(8:00-11:00)">上午(8:00-11:00)</option>
<option value="下午(1:30-5:00)">下午(1:30-5:00)</option>-->
</select>