我想从我的控制器中添加数据,以显示百里香的进度条。我尝试了不同的方法但没有工作。
<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" role="progressbar" **th:aria-valuenow="${model}"** aria-valuemin="0" aria-valuemax="100" **th:style="@{'width:'+ ${percent} +';'}"**>
<span class="sr-only">30% Complete (warning)</span>
</div>
答案 0 :(得分:3)
I tried using your answer and it didn't worked for me, but it helped to find an answer for me:
<div class="progress active">
<div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100" th:attr="aria-valuenow=${p.value}" th:style="'width:'+ ${p.percent}+'%;'"></div>
</div>
p.value and p.percent are model attributes that I send from my controller. Both have numeric values.
答案 1 :(得分:1)
找到它:
<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" role="progressbar" **th:aria-valuenow="${model}"** aria-valuemin="0" aria-valuemax="100" th:attr="aria-valuenow=${model}" th:style="'width:'+ ${percent}+';'}">
<span class="sr-only">30% Complete (warning)</span>
</div>