仿照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>
相关推荐
_菜鸟果果3 小时前
高德地图 JS API 2.0 在国产 Linux/ARM 电脑上渲染失败 的排查与解决
linux·开发语言·javascript
迷途小羔羊4 小时前
项目概述
java·javascript·后端
迷迭绿4 小时前
Cesium 轨迹回放播放器
前端·javascript·cesium
tryCbest5 小时前
Vue3——第 7 篇:组件基础——从注册到使用的完整流程
前端·javascript·vue.js
Eastmount8 小时前
[论文阅读] (54)NDSS26 JSIMPLIFIER:动静态与LLM如何协同完成JavaScript解混淆?
javascript·论文阅读·恶意代码分析·智能体安全·ndss
Ai-_Man9 小时前
ChatGPT还是不可以导出左侧所有对话,只能点进去单条内容导出,方法不对吗?
开发语言·javascript·人工智能·chatgpt·小程序·ecmascript
miofly9 小时前
GitHub 今日推荐|security-audit-skill:让编码代理自己审计漏洞还互相验证
javascript·开源·github
এ慕ོ冬℘゜9 小时前
es6理论总结
前端·javascript·es6
Lsx_10 小时前
微信支付接入全流程:JSAPI支付、小程序支付与H5支付
前端·javascript·全栈