可切换内容的标签页

 

效果图:

代码:

<template>
  <div>
    <div class="bruce flex-ct-x">
      <div class="tab-page">
        <nav>
          <h3>
            <input type="radio" name="tab" />
            <label for="tab1">标题1</label>
          </h3>
          <h3>
            <input type="radio" name="tab" />
            <label for="tab2">标题2</label>
          </h3>
          <h3>
            <input type="radio" name="tab" />
            <label for="tab3">标题3</label>
          </h3>
        </nav>
        <ul>
          <li>
            <input id="tab1" />
            <p>内容1</p>
          </li>
          <li>
            <input id="tab2" />
            <p>内容2</p>
          </li>
          <li>
            <input id="tab3" />
            <p>内容3</p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },

  methods: {},

  created() {}
};
</script>
<style lang="scss" scoped>
.tab-page {
  width: 300px;
  margin: 0 auto;
  nav {
    display: flex;
    border: 1px solid green;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 14px;
    h3 {
      position: relative;
      flex: 1;
      background-color: green;
      color: #fff;
      height: 100%;
      margin: 0;
      & + h3 {
        border-left: 1px solid #fff;
      }
    }
    input {
      display: none;
    }
    label {
      display: block;
      width: 100%;
      height: 100%;
      cursor: pointer;
    }
  }
  ul {
    overflow: hidden;
    scroll-behavior: smooth;
    border-top: none;
    height: 100px;
    width: 100%;
    padding: 0;
    border: 0;
    li {
      display: flex;
      position: relative;
      justify-content: center;
      align-items: center;
      height: 100%;
      font-size: 20px;
      color: blue;
      background-color: pink;
    }
    input {
      position: absolute;
      width: 0;
      height: 0;
      opacity: 0;
    }
  }
}
</style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值