当前位置: 首页 > article >正文

css实现自定义静态进度条-vue2

                                                                    实现如图所示

html:

 <div class="progress-container">
            <div class="progress-box left" :style="leftStyle">
              <div class="progress-value-top left">总中标电量</div>
              <div class="progress-value left">
                {{ responseAllData.totalBidPower }} MWh
              </div>
            </div>
            <div class="progress-box right" :style="rightStyle">
              <div class="progress-value-top right">有效调节电量</div>
              <div class="progress-value right">
                {{ responseAllData.vaildRespQty }} MWh
              </div>
            </div>
          </div>

          <div class="progress-container">
            <div class="progress-box" :style="leftStyleTwo">
              <div class="progress-value" style="color: #9daec3">
                平均达标率
              </div>
            </div>
            <div class="progress-box right" :style="rightStyleTwo">
              <div class="progress-value right">
                {{ responseAllData.avgReachRate }} %
              </div>
            </div>
          </div>

css:

.progress-container {
  display: flex;
  align-items: center;
  width: 100%;
  height: 16px;
  position: relative; /* 为了绝对定位内部元素 */
  margin-top: 50px;
  margin-bottom: 20px;
}

.progress-box {
  position: relative;
  height: 100%;
}
.progress-box.left {
  position: relative;
  height: 100%;
  margin-right: 5px;
}

.progress-value-top {
  position: absolute;
  top: -50px;
  font-weight: bold;
  color: #9daec3;
}

.progress-value-top.left {
  left: 0;
}

.progress-value-top.right {
  right: 0;
}

.progress-value {
  position: absolute;
  top: -25px;
  font-weight: bold;
}

.progress-value.left {
  left: 0;
  font-size: 14px;
  color: #1c77ea;
}

.progress-value.right {
  right: 0;
  font-size: 14px;
  color: #04c886;
}

vue2:

computed: {
    leftStyle() {
      return {
        width: `${this.responseAllData.totalBidPower}%`,
        backgroundImage: "linear-gradient(270deg, #159AFF 5%, #159aff66 100%)",
      };
    },
    rightStyle() {
      return {
        width: `${this.responseAllData.vaildRespQty}%`,
        backgroundImage: "linear-gradient(270deg, #04c88666 0%, #04C886 100%)",
      };
    },

    leftStyleTwo() {
      return {
        width: `${this.responseAllData.avgReachRate}%`,
        backgroundImage: "linear-gradient(270deg, #159AFF 5%, #159aff66 100%)",
      };
    },
    rightStyleTwo() {
      return {
        width: `${150 - this.responseAllData.avgReachRate}%`,
        backgroundImage:
          "linear-gradient(270deg, #ffffff80 0%, #00000000 100%)",
      };
    },
  },


http://www.kler.cn/news/324633.html

相关文章:

  • 【Elasticsearch】-dense_vector与hnsw的含义
  • idea 创建多模块项目
  • 探索基因奥秘:汇智生物如何利用组蛋白甲基化修饰测序技术革新农业植物基因组研究?
  • Hadoop三大组件之MapReduce(二)
  • matlab-对比两张图片的RGB分量的差值并形成直方图
  • 二次记录服务器被(logrotate)木马入侵事件
  • Redis实践之高级用法:管道、消息队列、事务、分布式锁
  • docker搭建clickhouse并初始化用户名密码
  • 【NLP】基于“检测器-纠错器”中文文本纠错框架
  • 大语言模型(LLM)效率优化技术全面综述:模型优化、数据优化、框架优化
  • 【unity进阶知识1】最详细的单例模式的设计和应用,继承和不继承MonoBehaviour的单例模式,及泛型单例基类的编写
  • 远程服务器安装anaconda并创建虚拟环境
  • 技术周总结09.23~09.29周日(分布式)
  • VCL界面组件DevExpress VCL v24.1.6全新发布
  • 【CSS/HTML】左侧固定,右侧自适应的布局方式理解margin负值理论
  • 反射及其应用---->2
  • 在Pytorch中为不同层设置不同学习率来提升性能,优化深度学习模型
  • Docker 进入容器命令详解
  • bytetrack 内存泄露问题
  • 时间安全精细化管理平台/iapp/mobile/facereg/facereg.html接口存在未授权访问漏洞
  • 类与对象—python
  • ERP系统委外工单管理
  • java NIO实现UDP通讯
  • - 串口通信
  • 多线程篇八
  • SpringBoot集成阿里easyexcel(二)Excel监听以及常用工具类
  • 阴影的基本原理
  • 梳理一下C语言中的格式说明符
  • uniapp js判断key是否在json中?
  • ArcgisEngine开发中,Ifeatureclass.Addfield 报错0x80040655处理方法