将背景颜色设置为文本字段不会使用 ext js 附加颜色

Setting backgroundcolor to the textfield is not appending the color using ext js

我的代码:

new Ext.form.TextField({
     value: "Name",
     style: {
         backgroundColor:'red'
     },
     listeners: {
         beforerender: function (e) {
             console.log(e)
             e.setStyle("backgroundColor", "#00cc99");
         }
     }
 });

通过应用样式配置或在渲染前附加颜色不起作用。甚至 bodyStyle 配置也没有用颜色填充文本框。如何解决?

谢谢

您可以根据需要将自定义 class 应用于元素和样式内部输入:

new Ext.form.TextField({
    value: "Name",
    cls: 'red-field'
});

和CSS class:

.red-field .x-form-text {
    background-color: red;
}