js实现标签页切换

<template>
  <div class="productGetmessage">
    <div class="productGet">
    <ul>
      <li v-for="(item,index) in getmessageTab" :key="index" @click="changeTabs(index)" 
      :class="[active==index?'amplification': '']">
        {{item}}
        <span v-show="active==index"></span>
      </li>
    </ul>
    <div class="getmessageBackground"></div>
    <div>
      <div v-show="active==0">
        <simpleVersions></simpleVersions>
      </div>
      <div v-show="active==1">经济版</div>
      <div v-show="active==2">豪华版</div>
    </div>
    </div>
  </div>
</template>
<script>
import simpleVersions from './simpleVersions.vue'
import "@/style/vehicle/productGetmessage.less";
export default {
  components: {
    simpleVersions
  },
  data() {
    return {
      getmessageTab: ["简约版", "经济版", "豪华版"],
      active: 0
    };
  },
  methods: {
    changeTabs(index) {
      this.active = index;
    }
  }
};
</script>
<style lang="less" scoped>
.productGetmessage {
  ul {
    padding: 0 52px;
    overflow: hidden;
    li {
      float: left;
      font-size: 14px;
      font-weight: 500;
      color: rgba(102, 102, 102, 1);
      line-height: 46px;
      margin-right: 68px;
      span {
        height: 5px;
        width: 28px;
        border-radius: 6px;
        background: #3b8afe;
        display: block;
        margin: 0 auto;
      }
    }
    li:last-child {
      margin-right: 0;
    }
    .amplification {
      font-size: 17px;
      font-weight: 500;
      color: rgba(51, 51, 51, 1);
    }
  }
  .getmessageBackground {
    height: 11px;
    background: rgba(247, 247, 247, 1);
  }
}

</style>

上图:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值