记录前端实现一个步骤条 横向纵向代码

1.横向步骤条

代码如下(示例):

<template>
    <div class="steps">
      <div
        v-for="(item,index) in process"
        :key="item.id"
        class="step step_r"
        :class="{active: active}"
      >
        <div style="position:absolute;right:-42px;height:80px;width:80px; overflow:hidden;">
          <div class="rotateBox"></div>
        </div>
        <div class="step_b">
          <div class="info">
            <p class="up">{{item.step}}</p>
            <p class="down">{{item.desc}}</p>
          </div>
          <div class="num">{{index+1}}</div>
        </div>
      </div>
    </div>
</template>

<script>
export default {
  data() {
    return {
        process: [
            {id: 1, step: 'step1',desc: 'xxxxxxxxx1'},
            {id: 2, step: 'step2',desc: 'xxxxxxxxx2'},
            {id: 3, step: 'step3',desc: 'xxxxxxxxx3'},
            {id: 4, step: 'step4',desc: 'xxxxxxxxx4'},
        ],
        active: true
    }
  }
}
</script>

<style lang='scss' scoped>
  .steps {
    width: 100%;
    display: flex;
    zoom: 1;
  }
  .steps::after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    font-size: 0;
    height: 0;
    line-height: 0;
  }
  .step {
    flex: 1;
    width: 320px;
    height: 80px;
    background: #E4F0FD;
    position: relative;
    .step_b {
      width: 230px;
      margin: 7px auto 7px 40px;
      display: flex;
      .num {
        width: 20px;
        height: 67px;
        font-size: 48px;
        font-family: PingFangSC-Regular;
        font-weight: 400;
        color: #666666;
        line-height: 67px;
        margin-right: 20px;
      }
      .info {
        height: 37px;
        margin-top: 15px;
        .up {
          width: 84px;
          height: 20px;
          font-size: 14px;
          font-family: PingFangSC-Regular;
          font-weight: 400;
          color: #666666;
          line-height: 20px;
        }
        .down {
          height: 17px;
          font-size: 12px;
          font-family: PingFangSC-Regular;
          font-weight: 400;
          color: #888888;
          line-height: 17px;
        }
      }
    }
  }
  //旋转的小方形盒子
  .rotateBox {
    content: "";
    border:10px solid #fff;
    border-bottom: none;
    border-left: none;
    background-color: #E4F0FD;
    height: 68px;
    width: 68px;
    position: absolute;
    display: block;
    top: 6px;
    right: 15px;
    z-index: 10;
    transform:rotate(45deg);
  }
  .step_l {
    margin-right: 0;
  }
  .active {
    background: #75B0DF !important;
    .num {
      color: #FFFFFF !important;
    }
    .up {
      color: #FFFFFF !important;
    }
    .down {
      color: #0E58AF !important;
    }
  }
  //被激活的步骤条的样式
  .active .rotateBox {
    background-color: #75B0DF;
    content: "";
    border: 10px solid #fff;
    border-bottom: none;
    border-left: none;
    height: 68px;
    width: 68px;
    position: absolute;
    display: block;
    top: 6px;
    right: 15px;
    z-index: 10;
    transform:rotate(45deg);
    // -ms-transform:rotate(45deg);  /* IE 9 */
    // -moz-transform:rotate(45deg);   /* Firefox */
    // -webkit-transform:rotate(45deg); /* Safari 和 Chrome */
    // -o-transform:rotate(45deg);   /* Opera */
  }
  //最后一步取消向右箭头
  .step:last-child .rotateBox{
    content: "";
    border: none;
    height: 0;
    width: 0;
    z-index: 11;
  }
</style>

在这里插入图片描述

2.纵向步骤条

代码如下(示例):

<template>
    <ul class="txcg_steplist">
        <li>
            <i class="node-icon"></i>
            <p class="index">1</p>
            <p class="time">2016-06-06</p>
            <p class="txt">111</p>
        </li>
        <li>
            <i class="node-icon"></i>
            <p class="index">2</p>
            <p class="time">2016-06-06 </p>
            <p class="txt">222</p>
        </li>
        <li>
            <i class="node-icon"></i>
            <p class="index">3</p>
            <p class="time">2016-06-06 </p>
            <picture  class="txt">333</picture>
        </li>
        <li>
            <i class="node-icon"></i>
            <p class="index">4</p>
            <p class="time">2016-06-06 </p>
            <p class="txt">44</p></li>
        <li>
            <i class="node-icon"></i>
            <p class="index">5</p>
            <p class="time">2016-06-05 </p>
            <p class="txt">5555555555555555555</p>
        </li>
        <li>
            <i class="node-icon"></i>
            <p class="index">6</p>
            <p class="time">2016-06-05 </p>
            <p class="txt">5555555555555555555</p>
        </li>
    </ul>
</template>
<script>
export default {
    data() {
        return {
            answerList: [
                {staffCode: 'xxxx', nodeContent: 'xxxxxxxxxxxxxxxxxxxxxxxxx'},
                {staffCode: 'xxxx', nodeContent: 'xxxxxxxxxxxxxxxxxxxxxxxxx'},
                {staffCode: 'xxxx', nodeContent: 'xxxxxxxxxxxxxxxxxxxxxxxxx'},
                {staffCode: 'xxxx', nodeContent: 'xxxxxxxxxxxxxxxxxxxxxxxxx'},
                {staffCode: 'xxxx', nodeContent: 'xxxxxxxxxxxxxxxxxxxxxxxxx'}
            ]
        }
    }
}
</script>
<style lang="scss" scoped>
ul {
    position:relative;
    margin-left: 10px;
    &> :before{
        z-index:1;
        content:"";
        border: 1px  #00000073 solid;
        width: 24px;
        height: 24px;
        color:#fff;
        position:absolute;
        border-radius: 50%;
        left:0;
        top:10px;
        transform:translate(-50%,-50%)
    }
    &> :last-child .node-icon{
        border-left:0
    }  
    li {
        list-style:none;
        position:relative;
        height:70px;
        color:#999;
        padding-left:20px;
        box-sizing:border-box;
        .time{
            color:#333;
            font-size:16px;
        }
        .txt{
            color:#999;
            font-size:14px;
        }
        .index {
            position: absolute;
            left: 0;
            transform: translateX(-50%);
        }
        .node-icon{
            position:absolute;
            left:0;
            top:40%;
            width:2px;
            height:50%;
            border-left:1px #00000026 solid;
        }
        
    }
}

</style>

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值