更改 sencha 中 select 字段的占位符颜色

Change color of placeholder for select field in sencha

我可以使用 css

实现输入字段
input::-webkit-input-placeholder {
   color: red !important;
}

但是 select 字段呢?仅供参考,我正在使用煎茶框架。 如果有人能帮助我,我将不胜感激。

您可以使用伪选择器来完成。

select option:checked{
    color: red;
}

一件事可能会有所帮助。您可能会与已应用于组件的样式作斗争。

选项 1

你在 css 中越具体,某些东西的优先级就越高。

例如:

input[type=text]::-webkit-input-placeholder,
input[type=password]::-webkit-input-placeholder {
    color: red;
    -webkit-text-fill-color: red;
}

另一件事是 select 字段实际上使用的是文本字段。

选项 2

您可以先设置一个默认的 select 选项,这样就会应用正常的文本颜色。

xtype: 'selectfield',
label: 'Marital Status',
labelWidth: '60%',
options: [{
    text: 'Select',
    value: 'select'
}, {
    text: 'Married',
    value: 'Married'
}]

希望这对您有所帮助...