封装箭头步骤条

<template>
  <div class="step-box">
    <div v-for="(item,index) in list" :key="index" :class="index + 1 === active ? 'active' : ''">
      <span>{{item}}</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'ArrowStepBar',
    props: {
      list: {
        type: Array,
        default: () => ['1、需求导入', '2、生成方案', '3、确定方案', '4、详情设计', '5、料号申请', '6、成果汇总']
      },
      active: {
        type: Number,
        required: true,
      }
    }
  }
</script>

<style scoped>
  .step-box {
    height: 70px;
    padding: 10px;
    background: #fff;
    display: flex;
    box-sizing: border-box;
  }

  .step-box div {
    padding: 0 20px;
    line-height: 50px;
    background: #f2f5f7;
    display: inline-block;
    position: relative;
    margin-right: 40px;
  }

  .step-box div span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .step-box div::after {
    content: '';
    display: block;
    border-top: 25px solid #f2f5f7;
    border-bottom: 25px solid #f2f5f7;
    border-left: 25px solid #fff;
    position: absolute;
    right: -25px;
    top: 0;
  }

  .step-box div::after {
    content: '';
    display: block;
    border-top: 25px solid transparent;
    border-bottom: 25px solid transparent;
    border-left: 25px solid #f2f5f7;
    position: absolute;
    right: -25px;
    top: 0;
    z-index: 10;
  }

  .step-box div::before {
    content: '';
    display: block;
    border-top: 25px solid #f2f5f7;
    border-bottom: 25px solid #f2f5f7;
    border-left: 25px solid #fff;
    position: absolute;
    left: -25px;
    top: 0;
  }

  .step-box div:first-child {
    padding: 0 20px 0 40px;
  }

  .step-box div:first-child::before {
    display: none;
  }

  .step-box div:last-child {
    padding: 0 40px 0 20px;
  }

  .step-box div:last-child::after {
    display: none;
  }

  .step-box .active {
    background: #e5f0fc;
    color: #0087ff;
  }

  .step-box .active::after {
    border-left-color: #e5f0fc;
  }

  .step-box .active::before {
    border-top-color: #e5f0fc;
    border-bottom-color: #e5f0fc;
  }
</style>

使用:

<template>
  <div id="app">
    <ArrowStepBar :active="1" />
  </div>
</template>

<script>
  export default {
    name: 'App',
    components: {
      ArrowStepBar: () => import('@/components/ArrowStepBar.vue')
    }
  }
</script>

效果如下:
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值