进度条图表简单化

简单化进度条展示,利用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 动态切换

相关推荐
一拳不是超人28 分钟前
Electron主窗口弹框被WebContentView遮挡?独立WebContentView弹框方案详解!
前端·javascript·electron
anyup38 分钟前
🔥2026最推荐的跨平台方案:H5/小程序/App/鸿蒙,一套代码搞定
前端·uni-app·harmonyos
雮尘1 小时前
如何在非 Claude IDE (TARE、 Cursor、Antigravity 等)下使用 Agent Skills
前端·agent·ai编程
icebreaker1 小时前
Weapp-vite:原生模式之外,多一种 Vue SFC 选择
前端·vue.js·微信小程序
icebreaker1 小时前
重走 Vue 长征路 Weapp-vite:编译链路与 Wevu 运行时原理拆解
前端·vue.js·微信小程序
wuhen_n1 小时前
代码生成:从AST到render函数
前端·javascript·vue.js
喝咖啡的女孩1 小时前
浏览器前端指南
前端
wuhen_n1 小时前
AST转换:静态提升与补丁标志
前端·javascript·vue.js
喝咖啡的女孩1 小时前
浏览器前端指南-2
前端
cxxcode1 小时前
从 V8 引擎视角理解微任务与宏任务
前端