仿照elementUI写个步骤条

效果图如下:

直接上代码:

bash 复制代码
<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>
相关推荐
漂流瓶jz5 小时前
Webpack如何实现万物皆可import?loader的使用/配置/手写实践
前端·javascript·webpack
ZC跨境爬虫5 小时前
跟着 MDN 学CSS day_41:显式轨道、隐式网格与区域命名放置
前端·javascript·css·ui·交互
Moment7 小时前
长上下文会最终杀死 Rag 吗?
前端·javascript·后端
kyriewen8 小时前
大文件上传最全指南:分片、断点续传、秒传,一篇就够了
前端·javascript·面试
我叫黑大帅9 小时前
解决聊天页内部滚轮改为页面滚动问题
javascript·后端·面试
新酱爱学习9 小时前
手搓 10 个 Skill 后,我把重复劳动收敛成了一套零依赖 CLI 工具
前端·javascript·人工智能
罗超驿9 小时前
13.JavaScript 新手入门指南:语法、变量、流程控制全解析
开发语言·javascript
ct97810 小时前
Three.js 性能优化(测量-定位-优化)
javascript·性能优化·three
研☆香10 小时前
es6新特性功能介绍(一)
前端·ecmascript·es6
陈_杨10 小时前
鸿蒙开发-疾阅App阅读训练功能技术解析
前端·javascript