Modify elementui default style, the style does not affect the other components

To modify el-select the style, for example:

1、<el-select>标签中添加 :popper-append-to-body="false"(局部修改样式和添加类才起作用,不会覆盖全局样式),然后添加class和popper-class进行样式修改。

2, use / deep / deep selector

<el-select
    :popper-append-to-body="false"
    v-model=""
    placeholder="请选择"
    class="select-style"
    popper-class="select-popper"
  >
    <el-option
      v-for="(item,index) in test"
      :key="index"
      :value="item.value"
      :label="item.label"
    ></el-option>
  </el-select>
/deep/ .select-style{
   margin-left: -6px; .el-select-dropdown{ position: absolute; z-index: 1001; border: none; border-radius: 4px; background-color: #FFF; -webkit-box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); -webkit-box-sizing: border-box; box-sizing: border-box; margin: 5px 0; } .el-select-dropdown__empty{ display:none; } .el-input__suffix{ display:none; }
   .el-input__inner {
      border: 1px solid #ccc;
      background-color: rgba(0, 0, 0, 0.8);
      color: rgba(255, 255, 255, 0.6);
    }
  }

Guess you like

Origin www.cnblogs.com/Lyui/p/12103008.html