el-tabs样式调整

默认

在这里插入图片描述

修改为

在这里插入图片描述

<el-tabs v-model="myradio" @tab-click="val=>{handleTabClick(val.name)}" class="new-tabs-header">
        <el-tab-pane label="PC端" name="1">
        </el-tab-pane>
        <el-tab-pane label="移动端" name="2">
         </el-tab-pane>
</el-tabs>


css


.new-tabs-header {
  background: white;
  /deep/ .tabs-card {
    .el-tabs__nav-scroll {
      padding: 0;
    }
  }
  /deep/ .el-tabs__nav-wrap {
    &::after {
      display: none;
    }
  }
  /deep/ .el-tabs__header {
    margin: 0;
  }
  /deep/ .el-tabs__nav-scroll {
    padding: 0 20px;
  }
  /deep/ .el-tabs__active-bar {
    background-color: $wit-primary; // 跟随 element  系统颜色  自己修改
    height: 4px;
    border-radius: 2px;
  }
  /deep/ .el-tabs__item:hover{
    span{
      color: $wit-primary; // 跟随 element  系统颜色  自己修改
    }
  }
  /deep/ .el-tabs__item.is-active {

    color: #333333;
    font-weight: bold;
    font-size: 16px;
    position: relative;
    span{
      color: $wit-primary;
    }
  }
  /deep/ .el-tabs__item:hover {
    color: #333333;
  }
  /deep/ .el-tabs__item {
    color: #909399;
    font-size: 14px;
    font-weight: 500;
  }
  /deep/ .el-tabs.tabs-card .el-tabs__item span {
    background: none;
    box-shadow: none;
    height: 54px;
    line-height: 54px;
    min-width: 0;
    padding: 0;
    margin: 0 18px;
  }
}         
  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以使用以下方法对 el-tabs 进行样式调整: 1. 使用 scoped 样式:在组件的 style 标签中添加 scoped 属性,以确保样式只应用于当前组件,避免与其他组件发生冲突。例如: ```html <template> <el-tabs> <!-- tabs 内容 --> </el-tabs> </template> <style scoped> .el-tabs { /* 自定义样式 */ } .el-tabs__header { /* 自定义样式 */ } .el-tabs__item { /* 自定义样式 */ } .el-tabs__active-bar { /* 自定义样式 */ } .el-tabs__content { /* 自定义样式 */ } </style> ``` 2. 使用全局样式:如果您希望在整个项目中应用相同的样式,可以在全局的样式文件中定义 el-tabs样式。例如,在 main.css 或 main.scss 文件中添加以下代码: ```css .el-tabs { /* 自定义样式 */ } .el-tabs__header { /* 自定义样式 */ } .el-tabs__item { /* 自定义样式 */ } .el-tabs__active-bar { /* 自定义样式 */ } .el-tabs__content { /* 自定义样式 */ } ``` 3. 使用自定义 class:如果您只想在某个特定的 el-tabs 组件中应用自定义样式,可以为 el-tabs 的 class 属性添加一个自定义类名,并在样式文件中针对该类名进行样式调整。例如: ```html <template> <el-tabs class="my-custom-tabs"> <!-- tabs 内容 --> </el-tabs> </template> <style> .my-custom-tabs { /* 自定义样式 */ } .my-custom-tabs .el-tabs__header { /* 自定义样式 */ } .my-custom-tabs .el-tabs__item { /* 自定义样式 */ } .my-custom-tabs .el-tabs__active-bar { /* 自定义样式 */ } .my-custom-tabs .el-tabs__content { /* 自定义样式 */ } </style> ``` 以上是一些常见的样式调整方法,您可以根据实际需求选择其中一种或结合使用多种方法。根据具体的样式调整需求,您可能需要使用其他 CSS 属性和选择器来精确控制 el-tabs 的外观和布局。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值