Ext Js 向 html 元素添加事件

Ext Js add event to html element

如何将 onChange 事件添加到我在另一个组件中呈现的 html 元素

  xtype: 'component',
                        html: {
                            html: '<input  type= "color" />'
                        },
                        itemId: 'colorPicker'
                    },

我想将以下事件监听器添加到输入元素中:

   theInput.addEventListener("input", function() {

   <<Do something with theColor value here>>

    }, false); 

在你的情况下代码是这样的:

html: '<input id=\'colorPickerBackground\' type=\'color\'></input>',
listeners: {
    afterrender: function(component) {
        var colorInput = component.getEl().down('#colorPickerBackground');
        colorInput.on('input', function() {
            console.log(colorInput.getValue());
        }); 
    }
}

Simple fiddle