解决element-ui自定义修改样式问题

使用的是element-ui,如果要修改el-table原始样式

1.可以自定义class,为了不影响全局样式

<div class="liquidataCase border-padding bg-shadow">
    <el-table border :data="tableData" style="width: 100%" highlight-current-row :height="tableHeight"> 
    ......
    </el-table>
</div>

css样式中不加scoped

<style lang="scss">
$wxcolor:#e4c21b;
.wxcolor{color:$wxcolor};
.liquidataCase .el-table tr td:nth-child(3) .cell{
  text-align: center;
  i{
    &:hover{
      cursor: pointer;
    }
  }
}
.liquidataCase .el-select__tags{
  flex-wrap: initial !important;
}
</style>

2.如果要在css样式中加scoped,要是用/deep/才会生效

<style lang="scss" scoped>
$wxcolor:#e4c21b;
.wxcolor{color:$wxcolor};
/deep/.liquidataCase .el-table tr td:nth-child(3) .cell{
  text-align: center;
  i{
    &:hover{
      cursor: pointer;
    }
  }
}
/deep/.liquidataCase .el-select__tags{
  flex-wrap: initial !important;
}
</style>

组件之间也不会影响

猜你喜欢

转载自blog.csdn.net/SmartJunTao/article/details/108580164