当前位置:网站首页>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>
边栏推荐
猜你喜欢
随机推荐
From "dual card dual standby" to "dual communication", vivo took the lead in promoting the implementation of the DSDA architecture
请问下通过flink sql读取hologres 的两张表的 binlog,然后如何进行join?
Disk management and file systems
disabledDate 日期选择器 datePicker
入职前,没想到他们玩的这么花
What impact does CIPU have on the cloud computing industry?
Switch principle
Getting Started Document 09 Standalone watch
spark operator - map vs mapPartitions operator
Network wiring and digital-to-system conversion
用户和用户组管理、文件权限管理
spark source code - task submission process - 1-sparkSubmit
spark operator-wholeTextFiles operator
Introductory document 05-2 use return instructions the current task has been completed
Problems encountered in installing Yolo3 target detection module in Autoware
Getting Started 04 When a task depends on another task, it needs to be executed in sequence
[问题已处理]-jenkins流水线checkout超时
智能运维会取代人工运维吗?
Hugo builds a personal blog
User and user group management, file permission management









