垂直时间轴 左边显示时间或者顺序 右边卡片式显示内容

<template>
    <div class="constructional-step">
      <div class="item-box" :class="index === dataList.length-1?'':'pb20'" v-for="(item,index) in dataList" :key="index + 'step'">
        <div class="vertical-line" v-if="index < dataList.length-1"></div>
        <div class="index-box icon-box text-c">{{ index+1}}</div>
        <div class="card-box">
          <p class="fs16 title-text fw">{{item.title}}</p>
          <p>{{item.content}}</p>
        </div>
      </div>
    </div>
</template>
<script>
    export default {
      name: "constructionalStep",
      data(){
        return{
          dataList:[
            {
              title:'组建评估小组',
              content:'由HR专家与对应部门的负责人'
            },
            {
              title:'评估前会议',
              content:'以会议的形式确定部门关键岗位;',
            },
            {
              title:'指标提炼',
              content:'依据关键岗位的岗位职责',
            },
           
          ]
        }
      },
    }
</script>
.constructional-step{
  padding: 0 20px;
  line-height: 1.85;
  .item-box{
    position: relative;  //父级定位
    display: flex;  // flex 布局
    align-items:stretch;   // 设置为stretch  直线的高度才会为父级的高度
    .index-box{
      position:absolute;
      top:20px;
    }
    .vertical-line{
      position: absolute;  //设置为absolute 
      left:10px;
      top:20px;
      width: 2px;
      height: 100%;
      border-left: 2px solid $borderColor;
    }
    .card-box{
      width: 100%;
      padding: 20px;
      border-radius:4px;
      background-color:$tableContentColor;
      margin-left: 40px;
    }
  }
}

类似于element ui 的时间线组件。

Vue横向时间轴带有卡片是一种常见的UI组件,用于展示时间线上的事件,并以卡片的形式展示事件的详细信息。这种组件通常由一个时间轴容器和多个时间轴卡片组成。 在Vue中实现横向时间轴带有卡片可以按照以下步骤进行: 1. 创建一个Vue组件,作为时间轴容器,可以使用`<div>`元素作为容器,并设置相应的样式。 2. 在时间轴容器中,使用`v-for`指令遍历事件数据数组,生成多个时间轴卡片。每个卡片可以使用`<div>`元素或者其他合适的HTML元素来表示。 3. 在每个时间轴卡片中,展示事件的详细信息,例如事件标题、时间、描述等。可以使用插值表达式`{{}}`或者其他Vue指令来动态绑定数据。 4. 根据需要,可以为时间轴卡片添加样式,例如设置背景颜色、边框样式等,以使其更加美观。 下面是一个简单的示例代码: ```html <template> <div class="timeline-container"> <div v-for="event in events" :key="event.id" class="timeline-card"> <div class="card-header">{{ event.title }}</div> <div class="card-body"> <div class="event-time">{{ event.time }}</div> <div class="event-description">{{ event.description }}</div> </div> </div> </div> </template> <script> export default { data() { return { events: [ { id: 1, title: 'Event 1', time: '2022-01-01', description: 'This is event 1 description.' }, { id: 2, title: 'Event 2', time: '2022-02-01', description: 'This is event 2 description.' }, // more events... ] }; } }; </script> <style> .timeline-container { display: flex; flex-direction: row; } .timeline-card { width: 200px; margin-right: 10px; background-color: #f0f0f0; border: 1px solid #ccc; } .card-header { padding: 10px; background-color: #ccc; color: #fff;} .card-body { padding: 10px; } .event-time { font-weight: bold; } .event-description { margin-top: 5px; } </style> ``` 这是一个简单的示例,你可以根据实际需求进行样式和功能的扩展。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值