横向时间轴

效果图:

html代码: 

<div class="timeLine">
  <div class="ul_box">
    <ul class="my_timeline" ref="mytimeline" style="margin-left: 10px;">
      <li class="my_timeline_item" v-for="(item, index) in timeLineList" :key="index">
        <!--圈圈节点-->
        <div class="my_timeline_node"
          :style="{ 'position': index === timeLineList.length - 1 ? 'relative' : '', 'top': index === timeLineList.length - 1 ? '28px' : '' }">
          <span>{{ item.things }}</span>
        </div>
        <!--线-->
        <div class="my_timeline_item_line" v-if="index !== timeLineList.length - 1"></div>
        <!--标注-->
        <div class="my_timeline_item_content">
          <span>{{ item.timestamp }}</span>
        </div>
      </li>
    </ul>
  </div>
</div>

 css代码:

.ul_box {
  width: 900px;
  height: 150px;
  display: inline-block;
  margin: 20px 2px;
  overflow: hidden;

  .my_timeline_item {
    display: inline-block;
    width: 100px;

    .my_timeline_node {
      width: 80px;
      height: 80px;
      color: #467AE9;
      font-size: 18;
      background: #467AE9;
      box-sizing: border-box;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;

      span {
        color: black;
      }
    }

    .my_timeline_item_line {
      width: 90px;
      height: 10px;
      margin: -40px 0 0 10px;
      border-top: 2px solid #467AE9;
      border-left: none;
    }

    .my_timeline_item_content {
      margin: 35px 0 0 0;
      display: flex;
      flex-flow: column;
      cursor: pointer;
    }
  }
}

js代码:

timeLineList: [
  {
    things: '1',
    timestamp: '2021-01-01',
  },
  {
    things: '2',
    timestamp: '2021-01-31',
  },
  {
    things: '3',
    timestamp: '2021-05-30',
  },
  {
    things: '4',
    timestamp: '2021-12-15',
  },
  {
    things: '5',
    timestamp: '2022-02-20',
  },
  {
    things: '6',
    timestamp: '2022-05-30',
  },
  {
    things: '7',
    timestamp: '2022-10-15',
  },
  {
    things: '8',
    timestamp: '2022-21-01',
  }
]

开发时偶尔会用到的横向时间轴,这写的比较基础部分,有不同的地方,在基础上自己添加也比较容易~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

柠檬不萌c

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

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

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

打赏作者

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

抵扣说明:

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

余额充值