仿照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>
相关推荐
还是大剑师兰特1 分钟前
Vite + Vue 3 一体化开发调试插件:vite-plugin-vue-devtools
前端·javascript·vue.js
晓得迷路了2 分钟前
栗子前端技术周刊第 123 期 - axios 包遭入侵、Babylon.js 9.0、Node.js 25.9.0...
前端·javascript·axios
꧁꫞꯭零꯭点꯭꫞꧂22 分钟前
JavaScript模块化规范
开发语言·前端·javascript
摸鱼的春哥24 分钟前
Agent教程22:AI大模型兼容,踩坑到崩溃
前端·javascript·后端
邂逅星河浪漫44 分钟前
【Vue2-ElementUI】:model、v-model、prop
javascript·vue.js·elementui
Jenlybein8 小时前
快速了解熟悉 Vite ,即刻上手使用
前端·javascript·vite
Ailrid8 小时前
@virid/core:用游戏引擎的思维来写应用-高度确定性的应用开发引擎
javascript
SuperEugene10 小时前
Vue3 组件复用设计:Props / 插槽 / 组合式函数,三种复用方式选型|组件化设计基础篇
前端·javascript·vue.js
nFBD29OFC10 小时前
利用Vue元素指令自动合并tailwind类名
前端·javascript·vue.js
zk_one12 小时前
【无标题】
开发语言·前端·javascript