thymeleaf中的下拉框(select option)回显选中

mac2024-05-13  33

<select class="chzn-select" name="roleClass" id="roleClass" data-placeholder="请选择类型" style="vertical-align:top;width: 100%"> <option label='请选择类型'></option> <option th:each="rc:${types}" th:text="${rc.name}" th:value="${rc.value}" th:selected="${rc.value} eq ${role.typeVal}"></option> </select>

${types}:List数据

${role.typeVal}:被编辑数据对应该字段的值

最新回复(0)