Vue+Element UI el-progress进度条内显示自定义数字及文字

server/2024/9/23 10:30:43/

需求

进度条内展示 具体的数字值,进度条外展示 百分比数值

在这里插入图片描述

数据

data() {return {reNum: 3214,rePer:40,warmPer: 40,warmNum:2132,}}

因为样式要求,显示的百分数也是自己写的哈 ,没有用进度条自带的

代码

    <div class="pick"><div class="proItem warmPk"><el-progress:text-inside="true":stroke-width="20":show-text="true":percentage="warmPer":format="format(warmNum)"color="#fff"></el-progress><div class="pro-num proTwoBK">{{ warmPer }}%</div></div><div class="proItem rePick"><el-progress:text-inside="true":show-text="true":stroke-width="20":percentage="rePer":format="format(reNum)"color="#fff"></el-progress><div class="pro-num proBK">{{ rePer }}%</div></div></div>

js方法

  format(row) {return () => {return row ? row : 0;};},

css样式代码

   .pick {margin-top: 1vh;.proItem {display: flex;align-items: center;justify-content: space-between;margin-left: 1.5vh;width: 100%;}.pro-num {font-weight: 700;font-size: 1.9vh;width: 19%;}.proBK {color: #40E9FF;}.proTwoBK {color: #F57A47}.warmPk {::v-deep.el-progress-bar__inner {background: #F67700 !important;}}.rePick {margin-top: 1.3vh;::v-deep.el-progress-bar__inner {background: #49AAE5 !important;}}::v-deep.el-progress-bar__outer {background: #353536 !important;}::v-deep.el-progress-bar {width: 100% !important;}::v-deep.el-progress-bar__inner {border-radius:10px !important;}::v-deep.el-progress {text-align: center !important;width: 81% !important}::v-deep.el-progress-bar__innerText {font-size: 1.4vh !important;font-weight: 700 !important;color: #fff !important;}}

2.使用插槽

<template><el-progress:percentage="50":stroke-width="26"text-inside:format="formatText"><template #text><span>自定义文字</span></template></el-progress>
</template><script>
export default {methods: {formatText(percentage) {// 如果需要,可以在这里根据percentage值来动态显示文字return `${percentage}% 自定义文字`;}}
};
</script>

http://www.ppmy.cn/server/33782.html

相关文章

利用大语言模型(KIMI)构建智能产品的信息模型

数字化的核心是数字化建模&#xff0c;为一个事物构建数字模型是一件非常繁杂和耗费人工的事情。利用大语言模型&#xff0c;能够轻松地生成设备的信息模型&#xff0c;我们的初步实验表明&#xff0c;只要提供足够的模板&#xff0c;就能够准确地生成设备的数字化模型。 我们尝…

汽车 - 降档补油超车

降档补油这事可是开手动档最大的乐趣之一&#xff0c;甚至还是进阶技巧“跟趾”的基础&#xff0c;所以建议开手动档的朋友一定要熟练掌握。 首先我们要明白手动档降档的意义&#xff0c;简单来说&#xff0c;发动机在转速高的时候能获得更好的加速力。这点相信开手动档的朋友都…

Unity UGUI Image 点击事件忽略空白像素区域

我们会遇到图片不是方形的不规则图片。这个时候我们希望只有点击到图像内容本身才算点击&#xff0c;点击空白区域则不算点击。而UGUI对图片的处理是整个图片都会算作点击区域&#xff0c;这样不能满足于我们的使用需求了。 首先我们需要把图片本身的Read/Write 选项打开 然后…

Angular基础-搭建Angular运行环境

这篇文章介绍了在Angular项目中进行开发环境搭建的关键步骤。包括node.js安装和配置、安装Angular CLI工具、安装angular-router、创建Angular项目等步骤。这篇文章为读者提供了清晰的指南&#xff0c;帮助他们快速搭建Angular开发环境&#xff0c;为后续的项目开发奠定基础。 …

【UnityRPG游戏制作】Unity_RPG项目之场景环境搭建和解析

&#x1f468;‍&#x1f4bb;个人主页&#xff1a;元宇宙-秩沅 &#x1f468;‍&#x1f4bb; hallo 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! &#x1f468;‍&#x1f4bb; 本文由 秩沅 原创 &#x1f468;‍&#x1f4bb; 收录于专栏&#xff1a;Uni…

二叉搜索树

一、概念 二叉搜索树又称二叉排序树&#xff0c;它或者是一棵空树&#xff0c;或者是具有以下性质的二叉树: 若它的左子树不为空&#xff0c;则左子树上所有节点的值都小于根节点的值 若它的右子树不为空&#xff0c;则右子树上所有节点的值都大于根节点的值 它的左右子树也分…

VoxAtnNet:三维点云卷积神经网络

VoxAtnNet:三维点云卷积神经网络 摘要IntroductionProposed VoxAtnNet 3D Face PAD3D face point cloud presentation attack Dataset (3D-PCPA) VoxAtnNet: A 3D Point Clouds Convolutional Neural Network for 摘要 面部生物识别是智能手机确保可靠和可信任认证的重要组件。…

Git常用(持续更新)

常用场景&#xff1a; 初始化&#xff1a; git config --global user.name "codelabs" git config --global user.email mycodelabs.com git init git remote add origin https://github.com/username/repository.git git pull origin master 提交&#xff1a; gi…