在用element ui的下拉框时,有时候会单独让更改下拉列表的样式,也就是el-option,其实加上两行代码就行;popper-class给select添加类名,popper-append-to-body可设置是否将弹框插入至body元素内

           <el-select
             :popper-append-to-body="false"
              popper-class="optionsContent"
           >
             <el-option
               v-for="item in entityList"
               :key="item.label"
               :label="$t(item.label)"
               :value="item.value"
             />
           </el-select>
//css
  ::v-deep .optionsContent {
      width: 690px !important;
  .el-select-dropdown__item {
      height: auto !important;
      line-height: 41px !important;
  }
}
Logo

前往低代码交流专区

更多推荐