Vue + Element 实现进度条 Progress

Vue + Element 进度条 Progress
前言:由于在公司可视化数字大屏项目中用到了,所以在博客里记录一下!如果能帮到你,那么点个赞吧,哈哈哈

话不多说,先直接上效果图,有需要的大家可借鉴借鉴。
在这里插入图片描述
HTML:

<template>
    <div class="absolute-left-right-top-bottom charts-main">
        <div class="content">
            <div class="content-header">
                <span class="text-header-1">疾病名称</span>
                <span class="text-header-2">人数</span>
                <span class="text-header-3">占比数</span>
            </div>
            <div
                v-for="adapter in adapters"
                :key="adapter.index"
                :class="'item-' + (adapter.index + 1)">
                <div class="item-content">
                    <div class="item-name">{{ adapter.name }}</div>
                    <div class="item-count">{{ adapter.count }}</div>
                    <div class="item-progress">
                        <el-progress :show-text="false" :percentage="adapter.rate" color="['#24F4C0', '#B4CBC54C']"
                                     :stroke-width="12"></el-progress>
                    </div>
                    <div class="item-rate">{{ adapter.rate }}%</div>
                </div>
                <div class="br"></div>
            </div>
        </div>
    </div>
</template>

JS:

<script>
export default {
    name: 'illnessTop10',
    components: {},
    data() {
        return {
            adapters: [
                {
                    name: '妊娠期高血压',
                    count: 5,
                    rate: 87,
                    index: 0
                },
                {
                    name: '妊娠肝内胆汁淤积',
                    count: 5,
                    rate: 61,
                    index: 1
                },
                {
                    name: '前置胎盘',
                    count: 25,
                    rate: 50,
                    index: 2
                },
                {
                    name: '胎盘早剥',
                    count: 15,
                    rate: 32,
                    index: 3
                },
                {
                    name: '子宫破裂',
                    count: 35,
                    rate: 24,
                    index: 4
                },
                {
                    name: '胎膜早破',
                    count: 49,
                    rate: 37,
                    index: 5
                },
                {
                    name: '羊水量异常',
                    count: 5,
                    rate: 10,
                    index: 6
                },
                {
                    name: '多胎妊娠',
                    count: 45,
                    rate: 34,
                    index: 7
                },
                {
                    name: '妊娠合并糖尿病',
                    count: 41,
                    rate: 31,
                    index: 8
                },
                {
                    name: '妊娠合并心脏病',
                    count: 38,
                    rate: 27,
                    index: 9
                }
            ]
        }
    }
}
</script>

CSS:

<style lang="scss" scoped>
.charts-main {
    background: url("/static/img/OPC/bg1.png") no-repeat;
    background-size: 100% 100%;
    width: 100%;
    height: 100%;
    position: relative;
    padding: 0 0 0 0;

    .content {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 95%;
        width: 100%;
        padding: 40px 0 0 0;

        &-header {
            position: relative;
            bottom: 4px;

            span {
                //width: 65px;
                //height: 17px;
                font-size: 16px;
                font-family: Microsoft YaHei UI;
                font-weight: 400;
                color: #8FA0D3;
                line-height: 31px;
            }
            .text-header-1 {
                position: relative;
                left: 20px;
            }
            .text-header-2 {
                position: relative;
                left: 138px;
            }
            .text-header-3 {
                position: relative;
                left: 236px;
            }

        }

        .br {
            width: 480px;
            height: 1px;
            background: #5B64BE;
        }

        .item-1 {
            padding: 0 0 0 20px;
            position: relative;

            .item-content {
                display: flex;
                flex-direction: row;

                .item-name {
                    flex: 0 0 39%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #E9F4FF;
                    line-height: 64px;
                }

                .item-count {
                    flex: 0 0 11%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #F3F8FF;
                    line-height: 64px;
                }

                .item-progress {
                    flex: 0 0 23.5%;
                    align-self: center;
                    height: 10px;
                    width: 429px;
                    position: relative;
                    left: 10px;

                    /deep/ .el-progress-bar__outer {
                        background-color: rgba(50,71,179,0.4);
                    }

                    /deep/ .el-progress-bar__inner {
                        background: linear-gradient(90deg, #FF5AAC, #FF0066);
                    }
                }

                .item-rate {
                    flex: 0 0 10%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #FF0066;
                    line-height: 64px;
                    padding: 0 0 0 20px;
                }
            }
        }

        .item-2 {
            padding: 0 0 0 20px;
            position: relative;

            .item-content {
                display: flex;
                flex-direction: row;

                .item-name {
                    flex: 0 0 39%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #E9F4FF;
                    line-height: 64px;
                }

                .item-count {
                    flex: 0 0 11%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #F3F8FF;
                    line-height: 64px;
                }

                .item-progress {
                    flex: 0 0 23.5%;
                    align-self: center;
                    height: 10px;
                    width: 429px;
                    position: relative;
                    left: 10px;

                    /deep/ .el-progress-bar__outer {
                        background-color: rgba(50,71,179,0.4);
                    }

                    /deep/ .el-progress-bar__inner {
                        background: linear-gradient(90deg, #FFC75A, #FF5400);
                    }
                }

                .item-rate {
                    flex: 0 0 10%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #FFC75A;
                    line-height: 64px;
                    padding: 0 0 0 20px;
                }
            }
        }

        .item-3 {
            padding: 0 0 0 20px;
            position: relative;

            .item-content {
                display: flex;
                flex-direction: row;

                .item-name {
                    flex: 0 0 39%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #E9F4FF;
                    line-height: 64px;
                }

                .item-count {
                    flex: 0 0 11%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #F3F8FF;
                    line-height: 64px;
                }

                .item-progress {
                    flex: 0 0 23.5%;
                    align-self: center;
                    height: 10px;
                    width: 429px;
                    position: relative;
                    left: 10px;

                    /deep/ .el-progress-bar__outer {
                        background-color: rgba(50,71,179,0.4);
                    }

                    /deep/ .el-progress-bar__inner {
                        background: linear-gradient(90deg, #37E08B, #02B317);
                    }
                }

                .item-rate {
                    flex: 0 0 10%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #37E08B;
                    line-height: 64px;
                    padding: 0 0 0 20px;
                }
            }
        }

        .item-4, .item-5, .item-6, .item-7, .item-8, .item-9, .item-10 {
            padding: 0 0 0 20px;
            position: relative;

            .item-content {
                display: flex;
                flex-direction: row;

                .item-name {
                    flex: 0 0 39%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #E9F4FF;
                    line-height: 64px;
                }

                .item-count {
                    flex: 0 0 11%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #F3F8FF;
                    line-height: 64px;
                }

                .item-progress {
                    flex: 0 0 23.5%;
                    align-self: center;
                    height: 10px;
                    width: 429px;
                    position: relative;
                    left: 10px;

                    /deep/ .el-progress-bar__outer {
                        background-color: rgba(50,71,179,0.4);
                    }

                    /deep/ .el-progress-bar__inner {
                        background: linear-gradient(90deg, #2357EB, #16D8E9);
                    }
                }

                .item-rate {
                    flex: 0 0 10%;
                    font-size: 16px;
                    font-family: Microsoft YaHei UI;
                    font-weight: bold;
                    color: #F3F8FF;
                    line-height: 64px;
                    padding: 0 0 0 20px;
                }
            }
        }
    }
}
</style>
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱吃香菜的胡先森

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值