vue 动态设置每个tab的颜色scss

在这里插入图片描述

  <div
  class="tab-line"
    :style="{ '--active-tab-bg': activeTabBg }"
  >
  ></div>

export default {
  computed: {
    activeTabBg() {
      return `var(--active-tab-bg-${this.data.key}, #3870ea)`;
    },
  },
}

<style lang="scss" scoped>
.tab-line {
  ::v-deep {
    .el-tabs__nav-scroll {
      border-bottom: 2px solid var(--active-tab-bg, #3870ea);
    }

    .el-tabs--card > .el-tabs__header .el-tabs__item {
      border-bottom: 0px;
    }
    .el-tabs--card > .el-tabs__header .el-tabs__nav {
      border: 0px solid #ebecf0;
    }

    .el-tabs__item {
      background: var(--neutral-5);
      font-size: 15px;
      font-weight: 400;
      color: #172b4d;
      border-radius: 5px 5px 0px 0px;
      margin-right: 10px;
      height: 32px;
      line-height: 34px;
      padding: 0 12px !important;
    }
    .el-tabs__item.is-active {
      color: #ffffff;
      background: var(--active-tab-bg, #3870ea);
      font-weight: 600;
    }
    .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
      border-bottom-color: transparent;
    }
    .el-tabs--card > .el-tabs__header .el-tabs__item {
      border-left: 0px solid #ebecf0;
    }
  }
}
.tab-card {
  ::v-deep {
    .el-tabs--card > .el-tabs__header .el-tabs__nav {
      border: 0px solid #ebecf0;
    }
    .el-tabs__item {
      background: transparent;
      font-size: 15px;
      font-weight: 500;
      color: #172b4d;
      border-radius: 5px 5px 0px 0px;
      margin-right: 10px;
      height: 32px;
      line-height: 34px;
      padding: 0 12px !important;
      color: #ffffff;
    }
    .el-tabs__item.is-active {
      color: #172b4d;
      background: #ffffff;
      margin: 6px 16px 0 10px;
      font-weight: 600;
    }
    .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
      border-bottom-color: transparent;
    }
    .el-tabs--card > .el-tabs__header .el-tabs__item {
      border-left: 0px solid #ebecf0;
    }
    .el-tabs__nav-scroll {
      background: var(--active-tab-bg, #3870ea);
    }
  }
}
</style>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值