:style="selectStyle(scope.row.pMTaskStatus)"  
selectStyle(val) {
	  switch (val) {
	    case '0':
	      return { backgroundColor: '#e6a23c',borderColor: '#e6a23c',borderRadius:'4px'}
	    case '1':
	      return { backgroundColor: '#409eff',borderColor: '#409eff',borderRadius:'4px'}
	    case '2':
	      return { backgroundColor: '#909399',borderColor: '#909399',borderRadius:'4px'}
	    default:
	    return { backgroundColor: '#909399',borderColor: '#909399',borderRadius:'4px'}
	  }
},
 <el-select v-model="scope.row.pMTaskStatus" :style="selectStyle(scope.row.pMTaskStatus)"  @change="handleChangeType($event,scope)"&gt;
<el-option
	v-for="option in options"
	:key="option.value"
	:label="option.label"
	:disabled="scope.row.pMTaskStatus === '2'"
	:value="option.value"
	&gt;
	{{ option.label }}
</el-option&gt;
  </el-select&gt;
备注:由于直接设置样式是不能生效的,因为会被input标签遮挡,随意我们还要给input标签设置背景颜色透明色。background-color: transparent;

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注