element-ui中 Progress 圆形进度条 自定义文字 底色 圆角 文字颜色等修改

vue中使用element-ui Progress 圆形进度条, 自定义文字 、底色、 圆角 、文字颜色等

在这里插入图片描述

1.圆形进度条底色修改,非底色修改官方文档中有说明。deep:样式穿透
    /deep/ .el-progress-circle__track {
      stroke: #EEEEEE;
    }
2.圆角修改 stroke-linecap=“square” ,stroke-linecp有三个值,分别为butt/round/square,默认值为round圆角模式
        <el-progress type="circle"  :percentage="25" :stroke-width="8" 
         stroke-linecap="square" />
3.进度条中文字修改,有两种模式,如不需要添加复杂样式,可使用format属性自行添加样式

例:

  <el-progress type="circle"  :percentage="25" :stroke-width="8" 
     stroke-linecap="square"  :format="format" />
  methods: {
    format(percentage) {
      let tex = '2012MB'
      return percentage + '%\n' + tex
    },
  }
 /deep/ .el-progress__text {
      white-space: pre;//使百分号与所添加文字换行
 }
4.如果需要给文字添加不同样式,需自定义文本内容

例:样式使用的less,可自行转换

      <div class="circleBox">
        <el-progress type="circle" :show-text="false" :percentage="25" :stroke-width="8" 
        stroke-linecap="square" />
        <div class="textCenter">
          <div>80%</div>
          <span>2012MB</span>
        </div>
      </div>
    .circleBox {
      position: relative;
      text-align: center;
      width: 200px;
      margin: 40px 0;
      .circleCenter {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        div {
          font-size: 26px;
          color: #1360FB;
          font-weight: 600;
          margin-bottom: 5px;
        }
        span {
          font-size: 14px;
          color: #999999;
        }
      }
    }
  • 11
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值