css实现时间轴样式年份选择器

效果图
在这里插入图片描述

<div class="right">
          <span class="label">评价周期</span>
          <ul class="year-list">
            <li v-for="(year, index) in years" :key="index">
              <label :class="{ active: currentYear === year }"
                ><input
                  name="year"
                  type="radio"
                  :value="year"
                  v-model="currentYear"
                />{{ year }}</label
              >
            </li>
          </ul>
        </div>
      //样式代码
.year-list {
          flex: 1;
          list-style: none;
          display: flex;
          position: relative;
          padding-top: 10px;
          box-sizing: border-box;
          margin-bottom: 0;
          &::before {
            content: "";
            display: block;
            width: 83.33%;
            height: 2px;
            background-color: #ddd;
            position: absolute;
            left: 8.335%;
            top: 6px;
          }
          > li {
            flex: 1;
            text-align: center;
            label {
              cursor: pointer;
              position: relative;
              &.active {
                color: #409eff;
              }
              > input {
                width: 10px;
                height: 10px;
                appearance: none;
                position: absolute;
                top: -8px;
                left: 50%;
                margin-left: -3px;
                &::before {
                  content: "";
                  display: block;
                  width: 4px;
                  height: 4px;
                  border-radius: 50%;
                  border: 2px solid #b5b5b5;
                  background-color: #fff;
                  box-sizing: content-box;
                }
                &:checked::before {
                  content: "";
                  display: block;
                  width: 6px;
                  height: 6px;
                  border-radius: 50%;
                  border: 1px solid #409eff;
                  box-sizing: content-box;
                }
                &:checked::after {
                  content: "";
                  display: block;
                  width: 4px;
                  height: 4px;
                  border-radius: 50%;
                  background-color: #409eff;
                  position: absolute;
                  top: 2px;
                  left: 2px;
                  box-sizing: content-box;
                }
              }
            }
          }
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值