el-select 下拉框自定义背景颜色

需求:根据后端返回的颜色值,渲染不同的背景颜色
实现效果:
el-select 下拉框自定义背景颜色_第1张图片
el-select 下拉框自定义背景颜色_第2张图片

 <el-select
          style="width: auto; max-width: none"
          v-model="sourceId"
          clearable
          :placeholder="$t('NeoLight.select')"
          @change="getSource(sourceId)"
        >
          <el-option
            v-for="item in sourceOptions"
            :key="item.sourceId"
            :label="item.sourceName"
            :value="item.sourceId"
            v-html="'
' + item.taskColor + ';width:' + '100%' + ';height:' + '90%' + '>' + item.sourceName + '
' "
>
el-option> el-select>

你可能感兴趣的:(element,前端,css)