当前位置:网站首页>el-progress实现进度条颜色不同
el-progress实现进度条颜色不同
2022-08-05 05:24:00 【MoXinXueWEB】
el-progress实现进度条颜色不同
实现效果:
实现代码如下:
<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>
边栏推荐
猜你喜欢
5分钟完成mysql离线安装
IP数据包格式(ICMP协议与ARP协议)
Mina的长连接和短连接
From "dual card dual standby" to "dual communication", vivo took the lead in promoting the implementation of the DSDA architecture
云计算——osi七层与TCP\IP协议
Wireshark packet capture and common filtering methods
OpenCV3.0 is compatible with VS2010 and VS2013
增长:IT运维发展趋势报告
有哪些事情是你做了运维才知道的?
Growth: IT Operations Trends Report
随机推荐
Regular expression small example - get number character and repeated the most
正则表达式小实例--验证邮箱地址
Mongodb query analyzer parsing
Getting Started 04 When a task depends on another task, it needs to be executed in sequence
Insight into the general trend of the Internet, after reading this article, you will have a thorough understanding of Chinese domain names
618,你也许可以清醒亿点点
[Problem has been resolved]-Virtual machine error contains a file system with errors check forced
The Servlet to jump to the JSP page, forwarding and redirection
Problems encountered in installing Yolo3 target detection module in Autoware
spark source code-RPC communication mechanism
el-autocomplete使用
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
wc、grep、tar、vi/vim
Advantages of overseas servers
Network wiring and digital-to-system conversion
LeetCode面试题
Operation and maintenance engineer, come and pick up the wool
To TrueNAS PVE through hard disk
I217-V network disconnection problem in large traffic under openwrt soft routing
传输层协议