进度条图表简单化

简单化进度条展示,利用css而非echarts

div 合集,外部灰色,内部按百分比动态设置宽度

复制代码
<div class="progress-container" id="`+ChartId+`">
     <div class="progress-bar"></div>
</div>
复制代码
const RateValue='70'
const Bar = document.querySelector(`#`+ChartId +` .progress-bar`);
if (Bar) {
    Bar .style.width = RateValue+`%`;
}

重点设置 .progress-bar 对应的css样式集

复制代码
.progress-container {
    width: 100%;
    height: 4px;
    background-color: #f5f5f5 !important; /* 浅灰色进度条背景 */
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #67c23a, #28a745) !important; /* 绿色渐变进度条 ,可配置任意颜色*/
    border-radius: 2px;
    transition: width 0.5s ease;
}

启动

1.灰色背景条

2.占比 70%

3.占比22%

根据RateValue 动态切换

相关推荐
GreenTea10 小时前
GrokBot 核心成员 Lauren Tan:每月交付 2000 个 PR 的人,是怎么用 AI 的
前端·后端·架构
mCell12 小时前
用 Knip 清理 AI Coding 留下的冗余代码
前端·ai编程·前端工程化
笃行35012 小时前
使用Rokid AIUI做了一个童年推箱子游戏
前端
excel13 小时前
前端加密的作用与使用场景
前端
计算机魔术师14 小时前
纽约时报版权诉讼披露:微软高管内部称训练 AI 是人类历史上最大规模劳动窃取
前端
去伪存真15 小时前
大模型的参数量为什么那么大?
前端·人工智能
IT_陈寒15 小时前
Java空指针这次真把我坑惨了
前端·人工智能·后端
八荒启·交互动画16 小时前
# Web特效020—让 Web 特效真正动起来:时间循环应该怎么接
前端·webgl·网页特效·八荒启-交互动画·八荒启
动恰客流统计16 小时前
线下零售数字化浪潮下,客流统计的3个核心发展趋势
大数据·前端·人工智能
用户9385156350717 小时前
从小米前端面试题,彻底搞懂闭包、作用域链与 useState 惰性初始化
前端·面试