仿照elementUI写个步骤条

效果图如下:
步骤条
直接上代码:

<template>
  <div class="">
    <div class="steps">
      <div class="step" v-for="(step, index) in steps" :key="index">
        <div
          class="icon"
          @click="currentStep = index"
          :class="{ icon: true, 'active-icon': currentStep == index }"
        >
          <div class="cir">{{ index + 1 }}</div>
          <div class="title">{{ step }}</div>
        </div>
        <div v-if="index < steps.length - 1" class="line"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      steps: ["投标函格式", "评标原则", "评标方法", "招标文件"],
      currentStep: 0,
    };
  },
  created() {},
  mounted() {},
  methods: {},
};
</script>

<style lang='scss' scoped>
.steps {
  width: 100%;
  display: flex;

  .step {
    flex: 1;
    display: flex;
    line-height: 25px;
    position: relative;
    .icon {
      position: relative;
      z-index: 1;
      background: #fff;
      padding: 0 10px;
      display: flex;
      cursor: pointer;
      color: #00000073;

      .cir {
        width: 25px;
        height: 25px;
        text-align: center;
        line-height: 25px;
        box-sizing: border-box;
        border-radius: 50%;
        border: 1px solid #00000073;
      }
      .title {
        margin-left: 10px;
        width: auto;
      }
      &:hover {
        color: #1989fa;
        .cir {
          color: #1989fa;
          border: 1px solid #1989fa;
        }
      }
    }
    .active-icon {
      color: #1989fa;
      .cir {
        color: #fff;
        border: 1px solid #1989fa;
        background-color: #1989fa;
      }
      &:hover {
        .cir {
          color: #fff;
        }
      }
    }

    .line {
      margin-left: 5px;
      background-color: #e8e8e8;
      flex: 1;
      position: absolute;
      top: 12px;
      left: 0;
      right: 0;
      height: 1px;
    }
  }
}
.steps .step:last-child {
  flex-basis: auto !important;
  flex-shrink: 0;
  flex-grow: 0;
}
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值