html - thymeaf 中的参数 css 宽度
问题描述
小米代码是:
<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} 更改宽度值,但我不知道。
我该怎么做?
我读了这篇文章,但它对我不起作用。使用 thymeleaf 设置 CSS 样式属性
解决方案
使用th:width="${planificacion.porcentaje}"
或th:attr="width=${planificacion.porcentaje}"
推荐阅读
- android - Android - 指定每个片段的主题
- swift - swift中的奇怪字典
- php - App Engine - PHP Symfony - 如何要求使用 app.yaml 登录
- c# - MongoDB C#驱动程序如何更新更新文档的集合
- c# - ShaderGraph 材质颜色变化
- node.js - EJS/Node/Express - 有一个部分标题,如何更改每个页面的标题?
- angular - 如何正确使用 mat-autocomplete 和远程 graphQL 数据?
- unity3d - 着色器图,纹理不循环
- r - R中的子集字符串
- ios - 为什么我不能将从 Firestore 获取的值分配给 Swift 中的数组?