进度条界面实现

 一、实现一个项目进度界面

<!-- 进度条start -->
    <div v-show="nodeList.length>0" class="steps" style="display: flex;">  
      <div v-for="(item,index) in nodeList" style="display: flex;flex: 1;">
        <div class="zt-con"><div class="zt" style="min-width: 100px;"></div></div>
        <div class="middle" :class="item.status">
          {{ item.status=='finish'?'已完成':item.status=='process'?'进行中':'未开始' }}
          <div class="desc">{{ item.node_name }}</div>
        </div>
      </div>

      <div class="top">
        <div style="display: flex;">
          <div style="display: flex;align-items: center;"><div class="zt" style="width: 100px;"></div></div>
          <div class="triangle-con"><div class="triangle"></div></div>
        </div>
      </div>
    
    </div>
    <!-- 进度条end -->

样式

.steps{
  width: calc(100% - 30px);
  margin: 0 0 70px 15px;

  .zt-con{
    display: flex;
    align-items: center;
    width: calc(100% - 50px);
  }
  .middle{
    height: 70px;
    width: 70px;
    border-radius: 50%;
    border: 1px solid #333;

    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;

    .desc{
        position: absolute;
        top: 70px;
        text-align: center;
        border-radius: 3px;
        font-weight: 600;
        padding: 3px;

        background-color: #f2f2f2;
        width: 130px;
      }
  }
  .top{
    display: flex;
    justify-content: center;
    .triangle-con{
      width: 70px;
      height: 70px;
      display: flex;
      align-items: center;
    }
    /* 头部三角 */
    .triangle{
      border-style: solid;
      border-width: 25px 25px 25px 25px;
      border-color:  transparent  transparent  transparent rgb(79 173 234);
      width: 0px;
      height: 0px;
      border-radius: 5px;
    }
  
  }
  .zt{
      height: 10px;
      width: 100%;
      background-color: rgb(79 173 234);
    }
  .finish{
    background-color: rgb(86 143 240);
    .desc{
      background-color: rgb(86 143 240);
      color: #fff;
    }
  }
  .process{
    background-color: #b5c649;
    .desc{
      background-color: #b5c649;
    }
  }
}

 效果

二、实现一个进度条

<div :class="record.project_schedule.match(/\d+/)[0]>60?'nomal':'warning'" style="display: flex;align-items: center;">
          <div class="process">
            <div style="overflow: hidden;border-radius: 100px;">
              <div class="act-num" :style="{width:calculateWidth(record.project_schedule)}"></div>
            </div>
            <div class="over" v-if="record.project_schedule.match(/\d+/)[0]>60"></div>
            <div v-else class="noover" ></div>
          </div>
          <div class="process-num">{{ record.project_schedule }}</div>
        </div>

 样式

  .nomal,.warning{
    .process-num{
      padding-left: 3px;
      font-weight: 500;
    }
  }

  .process{
    position: relative;
    flex: 1;
    height: 12px;
    background-color: #EBEBEB;
    border-radius: 100px;
    .act-num{
      background-color: rgb(44 146 236);
      height: 12px;
      border-radius: 100px;
    }
    
    
  }
  .nomal{
    .over{
      position: absolute;
      left: 60%;
      top: 0;
      width: 1px;
      height: 12px;
      background-color: #fff;
    }
    .process-num{
      color: rgb(44 146 236);
    }
  }

  .warning{
    .process-num{
      color: rgb(255 40 83);
    }
    .act-num{
      background-color: rgb(255 40 83);
    }
    .noover{
      position: absolute;
      left: 60%;
      bottom: 0;
      width: 10px;
      height: 21px;
      background-image: url("../../../../assets/flag.png");
      background-size: cover;
    }
  }

效果:

可根据进度数值改变样式

1 进度大于60,蓝色;进度小于60,红色

2 在60处有红旗标注或白线

 

  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值