我在json文件中有数据.我从这个json生成了一个progressbar.
json文件:
jsonArray = [
{
text: 'Show this first',
gradue: 92,
},
{
text: 'Then show this after some millisconds',
gradue: 88,
},
{
text: 'Show this at least after some more milliseconds',
gradue: 81,
}
];
css代码如下,以使progressbar加载从0%到92%
.percentage {
color: #522003;
font-size: 10px;
font-weight: bold;
margin-right: 0.6rem;
line-height: 9px;
text-align: end;
}
@property --p {
syntax: "<number>";
inherits: true;
initial-value: 0;
}
.skill-progress-fill {
--p: 20;
background: linear-gradient(to right, #e15d10, #f07d3b);
height: 100%;
border-radius: inherit;
animation: animation 4s cubic-bezier(0.28, 1.07, 0.24, 1.01);
width: calc(var(--p) * 1%);
}
@keyframes animation {
0% {
width: 0%;
}
100% {
width: calc(var(--p) * 1%);
}
}
Anguar HTML文件:
<div class="skill-progress-fill" style="--p:{{ percent }}"><span class="percentage">{{ percent }}%</span></div>
有人能帮我解决这个问题吗.顺便说一句,我不是在寻找 bootstrap 解决方案.