Mi代码是:
<tr th:each="planificacion : ${planificaciones}"
th:onclick="'window.location.href = \'' + @{/planificacion/{idp}(idp=${planificacion.id})}+ '\''">
<td th:text="${planificacion.nombre}"></td>
<td>
<div th:if="${planificacion.completado}">
<span class="badge badge-pill badge-success"
style="font-size: 80%; padding: 6px 18px;">Completo</span>
</div>
<div th:if="${not planificacion.completado}">
<span class="badge badge-pill badge-danger"
style="font-size: 80%; padding: 6px 18px;">Incompleto</span>
</div>
</td>
<td>
**<div class="progress">
<div class="progress-bar progress-bar-success progress-bar-striped active"
role="progressbar" aria-valuenow="0" aria-valuemin="0"
aria-valuemax="100" style="width:0%">
<span id="current-progress"></span>
</div>
</div>**
</td>
<td><a class="btn btn-danger"
th:href="@{/borrar_planificacion/{id}(id=${planificacion.id})}">
<i class="fas fa-trash-alt"></i>
</a></td>
</tr>
</table>
我想使用控制器变量$ {planificacion.porcentaje}更改宽度值,但我不知道。
我该怎么做?
我阅读了这篇文章,但对我不起作用。 Setting CSS style attributes with thymeleaf
答案 0 :(得分:1)
按照Thymeleaf documentation - Setting attribute values
使用th:width="${planificacion.porcentaje}"
或th:attr="width=${planificacion.porcentaje}"