当前位置:网站首页>el-progress实现进度条颜色不同
el-progress实现进度条颜色不同
2022-08-05 05:24:00 【MoXinXueWEB】
el-progress实现进度条颜色不同
实现效果:
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-c22et1ka-1655793148148)(C:\Users\huawei\AppData\Roaming\Typora\typora-user-images\image-20220620223508990.png)]](/img/df/46a145da4834cf15178e1e39eb2f45.png)
实现代码如下:
<template>
<div>
<h1>进度条排名</h1>
<div style="width: 400px; height: 40px; margin: 0 auto; display: flex; align-item: center; justify-content: flex-start" v-for="(item, index) in egList" :key="index">
<div style="width: 15%; line-height: 40px; text-algin: center; padding-left:10px">{
{ index+1 }}</div>
<div style="width: 65%; text-algin: left; font-size: 8px;">
<!-- 名称 -->
<div style="height: 20px;">{
{item.name}}</div>
<el-progress :percentage="item.num/1000*100" :show-text="false" :stroke-width="8" :color="getColor(index)"></el-progress>
</div>
<div style="width: 20%; line-height: 40px; padding-right: 10px; min-width: 40px">{
{Number(item.num).toFixed(2)}}</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
egList: [
{
num: 889,
name: '小龙虾'
},
{
num: 785,
name: '车厘子'
},
{
num: 686,
name: '榴莲'
},
{
num: 535,
name: '海参'
},
{
num: 423,
name: '鲍鱼'
},
{
num: 400,
name: '炒鱿鱼'
},
{
num: 388,
name: '小洋房'
},
{
num: 376,
name: '庄园'
}
]
}
},
mounted() {},
methods: {
// 针对排名前三的颜色特殊处理
getColor(val) {
switch(val) {
case 0:
return '#ad2410';
// break;
case 1:
return '#e67845';
// break;
case 2:
return '#3d6aff';
// break;
default:
'#2f53c9';
break;
}
}
}
}
</script>
default:
'#2f53c9';
break;
}
}
}
}
</script>
边栏推荐
- [Day6] File system permission management, file special permissions, hidden attributes
- Call the TensorFlow Objection Detection API for object detection and save the detection results locally
- time complexity and space complexity
- NIO works is analysed
- Mongodb query analyzer parsing
- What are some things that you only know when you do operation and maintenance?
- 错误类型:反射。ReflectionException:无法设置属性“xxx”的“类”xxx”与价值“xxx”
- sql server 重复值在后面计数
- [Day8] Commands involved in using LVM to expand
- VLAN介绍与实验
猜你喜欢
随机推荐
Mongodb查询分析器解析
LeetCode Interview Questions
Small example of regular expression--remove spaces in the middle and on both sides of the string
[问题已处理]-虚拟机报错contains a file system with errors check forced
Does flink cdc currently support Gauss database sources?
错误类型:反射。ReflectionException:无法设置属性“xxx”的“类”xxx”与价值“xxx”
Spark source code-task submission process-6.1-sparkContext initialization-create spark driver side execution environment SparkEnv
RAID disk array
7 steps to complete cloud monitoring
Spark source code - task submission process - 4-container to start executor
深度 Zabbix 使用指南——来自惨绿少年
运维工程师,快来薅羊毛
618,你也许可以清醒亿点点
Hugo builds a personal blog
原生JS带你了解数组方法实现及使用
通过反射获取Class对象的四种方式
In-depth Zabbix user guide - from the green boy
[Day8] Commands involved in using LVM to expand
The spark operator - coalesce operator
Wechat applet page jump to pass parameters








