原生步骤条书写

步骤条预览

第一步:
在这里插入图片描述
第二步:
在这里插入图片描述
第三步:
在这里插入图片描述

代码展示

html

  <div class="contract">

    <div class="step-box">
      <div class="step-part" v-for="(step,index) in stepArray" :key="index">
        <div class="step-txt">
          <span :class="active >= step.id ? 'step-id-active' : 'step-id'" >
          <!--    van-icon 是框架vant,如果你的项目未使用vant框架,可以换成一个本地的小图标  
         		   判断条件不要忘记 v-if="active > step.id"     
          -->
            <van-icon v-if="active > step.id" name="checked" color="#1989fa" size="20" style="background: #FFFFFF;"/>
            <span v-else>{{step.id + 1}}</span>
          </span>
          <span :class="active > step.id ? 'step-line-active' : 'step-line'" v-show="step.id !== 2"></span>
        </div>
        <span class="step-name">{{step.name}}</span>
        <span class="step-detail">{{step.detail}}</span>
      </div>
    </div>

    <br>
    <br>
    <br>
    <button @click="active = 0 ">0</button>
    <button @click="active = 1 ">1</button>
    <button @click="active = 2 ">2</button>

  </div>

js
基于vue

import {reactive, ref} from "vue";

const active = ref(0);
const stepArray = reactive([
  {
    id:0,
    name:'合同信息',
    detail:'填写合同信息',
  },
  {
    id:1,
    name:'合同模板',
    detail:'填写合同信息',
  },
  {
    id:2,
    name:'合同发起',
    detail:'预览和发起',
  }
])

css


.contract{
  width: 100%;
  height: 100%;
  overflow: auto;

  .step-box{
    width: 100%;
    height: 120px;
    background: #FFFFFF;
    display: flex;
    justify-content: center;
    text-align: center;

    .step-part{
      width: 30%;
      text-align: center;

      .step-txt{
        padding-top: 10px;
        display: flex;
        position: relative;

        .step-id-active{
          display: block;
          background: #409EFF;
          width: 20px;
          height: 20px;
          line-height: 20px;
          text-align: center;
          border-radius: 50px;
          color: #FFFFFF;
          font-size: 12px;
          margin-left: calc(50% - 10px);
        }

        .step-id{
          display: block;
          background: #DCDEE0;
          width: 20px;
          height: 20px;
          line-height: 20px;
          text-align: center;
          border-radius: 50px;
          color: #FFFFFF;
          font-size: 12px;
          margin-left: calc(50% - 10px);
        }

        .step-line-active{
          width: calc(100% - 20px);
          height: 3px;
          background: #409EFF;
          display: block;
          position: absolute;
          top: 18px;
          left: calc(50% + 11px);
        }

        .step-line{
          width: calc(100% - 20px);
          height: 3px;
          background: #DCDEE0;
          display: block;
          position: absolute;
          top: 18px;
          left: calc(50% + 11px);
        }
      }


      .step-name{
        display: block;
        color: #323233;
      }

      .step-detail{
        display: block;
        font-size: 12px;
        color: #969799;
      }
    }
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海鸥两三

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值