vue+css实现的步骤条(项目时间进度条)效果

vue+css实现的步骤条效果
进行作业时,因为element提供的步骤条样式太少了,就自己写了个,整体效果如图所示
功能:
可以根据所传的数组,去分布步骤条的总需步骤
根据数组里对象的state属性,可以显示步骤条的进度

liner组件代码
<template>
  <div>
    <div
      v-for="(item, index) in option"
      :key="index"
      class="container"
      :style="{width: (1 / (option.length-1)) * 100 + '%'}"
    >
      <span
        class="bigSolt"
        :style="{left: option.length === 1?'100%':(index === (option.length-1)? -2 + 'px': index/ (option.length - 1) * 100) + '%',borderColor:item.state === 'true'? '#3b88fd' : '#C9D3E4'}"
      >
        <span class="slot" :style="{backgroundColor: item.state === 'true'? '#3b88fd' : '#C9D3E4'}"></span>
      </span>
      <div class="content">
        <div class="title">
          <span>{{ index === 0? '创建项目' : (index === option.length - 1? '完成':'审批人') }}</span>
        </div>
        <div class="name">
          <span>{{ item.name }}</span>
        </div>
      </div>
      <div class="date">{{ item.date }} </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    option: Array
  },
  mounted() {
    console.log(this.option)
  }
}
</script>

<style lang="scss" scoped>
.container {
  display: inline-block;
  vertical-align: top;
  .bigSolt {
    position: absolute;
    top: -3px;
    left: 0;
    width: 8px;
    height: 8px;
    padding: 1px;
    border: 1px solid #3b88fd;
    border-radius: 50%;
    box-sizing: content-box;
    background-color: #fff;
    z-index: 999;
    .slot {
      position: absolute;
      top: 1px;
      left: 1px;
      width: 8px;
      height: 8px;
      background-color: #3b88fd;
      border-radius: 50%;
      box-sizing: content-box;
    }
  }
  .content {
    display: inline-block;
    padding-top: 20px;
    .title {
      font-size: 13px;
      font-weight: bold;
      span {
        margin-left: -40%;
      }
    }
    .name {
      margin-top: 10px;
      font-size: 10px;
      color: #383838;
      span {
        margin-left: -40%;
      }
    }
  }
  .date {
    margin-top: 10px;
    margin-left: -50px;
  }
}
.container:last-child {
  position: absolute;
}

</style>

  • 1
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值