点击切换的步骤条

 

 

<template>
    <section class="main-content">
        <section class="content-body pall15">
          <section class="content-body mt20">
            <ul class="titleList">
              <li v-for="(item,index) of list" :key="index">
                <div class="tableList">
                     <div style="" class="corderClass" @click="toseve(item,index)">
                      <p>{{item.doing}}</p>
                      <div :class="{title:true,todo:item.doing=='todong',tosuss:item.doing=='success',addClass:item.toClsk}">{{index+1}}</div>
                      <p>{{item.title}}</p>
                    </div>
                    <i class="boederClass"></i>
                </div>
              </li>
            </ul>
          </section>
           <section class="content-body mt20">
              <keep-alive>
                <component :is="currentTabComponent"></component>
              </keep-alive>
           </section>
        </section>

    </section>
</template>

<script>
    export default {
        data() {
            return {
              active:2,
              list:[{title:'标题1',doing:'success',toClsk:false},
              {title:'标题2',doing:'success',toClsk:false},
              {title:'标题3',doing:'todong',toClsk:false},
              {title:'标题4',doing:'todong',toClsk:false},
              {title:'标题5',doing:'todong',toClsk:false}
              ],
              currentTabComponent:''
            }
        },
        beforeRouteUpdate (to, from, next) {
            // 在当前路由改变,但是该组件被复用时调用
            // 可以访问组件实例 `this`
            let param = {
                path    : window.location.origin+from.fullPath,
                data    : this.$data
            }
            this.$store.dispatch('setCache',param);
            next()
        },
        beforeRouteLeave (to, from, next) {
            // 导航离开该组件的对应路由时调用
            // 可以访问组件实例 `this`
            let param = {
                path    : window.location.origin+from.fullPath,
                data    : this.$data
            }
            this.$store.dispatch('setCache',param);
                next()
        },
        mounted(){
            this.$store.dispatch('getCache').then(res=>{
                if(res.success){
                    Object.assign(this.$data , res.model);
                }else{
                    this.init();
                }
            })
        },
        methods: {
            init(){

            },
            toseve(item,index){
              console.log(item,index)
              this.list.map(items=>{
                if(items.title==item.title){
                   this.$set(items,'toClsk',true)
                }else{
                   this.$set(items,'toClsk',false)
                }

              })
            }
        }
    }
</script>

<style scoped lang="scss">
  .titleList{
    display: flex;
    justify-content: flex-start;
    flex-wrap: nowrap;
    li{
      box-flex: 1;
      -webkit-box-flex: 1;
      -moz-box-flex: 1;
      width:100%;


      .tableList{
         height:100px;
        // display: table;
        width:100%;
        position: relative;
        .corderClass{
          width:50px;
          text-align:center;
          // display: table-cell;
           position: absolute;
          top: 50%;left: 50%;
          -webkit-transform: translate(-50%, -50%);
          -moz-transform: translate(-50%, -50%);-ms-transform: translate(-50%, -50%);
          -o-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
          z-index:10;
        }
        .boederClass{
          display: inline-block;
          width:100%;
          position:absolute;
          border-top:2px solid #eee;
          top:49px;
          left:0;
          z-index: 2;
        }
      }


    }
  }
   .title{
        width:50px;
        height:50px;
        text-align: center;
        line-height: 50px;
        border-radius: 50%;
        color:#fff;
        // display: inline-block;

      }
   .todo{
      background: #eee;
      border:1px solid #ddd;
    }
    .tosuss{
      background: #29c1c2 ;
      border:1px solid #29c1c2 ;
    }
    .addClass{
      background: #409EFF ;
      border:1px solid #409EFF ;
    }
</style>

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值