Javascript ExtJS4-自动el宽度和高度属性

Javascript ExtJS4-自动el宽度和高度属性,javascript,extjs,extjs4,extjs4.2,Javascript,Extjs,Extjs4,Extjs4.2,你好,我正在使用ExtJS4构建一个web应用程序,我想在图像上添加一个href 我有一个这样定义的图像: { xtype: 'image', x: 87, y: 180, autoEl: { tag: 'a', href: 'resources/promoStubs

你好,我正在使用ExtJS4构建一个web应用程序,我想在图像上添加一个href

我有一个这样定义的图像:

            {
                xtype: 'image',
                x: 87,
                y: 180,
                autoEl: {
                    tag: 'a',
                    href: 'resources/promoStubs/eventTalkPromo.jpg',
                    target: '_blank',
                    x: 87,
                    y: 180,
                    height: 30,
                    width: 30,
                    length: 30,

                },
                height: 30,
                itemId: 'paw1',
                width: 30,
                src: 'resources/graphics/pawpromo.png'
            },
我是从你那里得到这个主意的

但是,发生的情况是,图像非常大,
宽度
高度
属性根本不应用于图像。关于如何在具有autoEl属性的图像中指定宽度和高度,有什么想法吗

感谢您的帮助。谢谢。

请为您的xtype添加一个imgCls属性,如下所示,并为其编写一个css类。 以下是最新的

希望这对你有帮助

Ext.onReady(function () {
    Ext.create('Ext.Img', {
        renderTo: Ext.getBody(),
        src: 'https://cdn1.iconfinder.com/data/icons/yooicons_set01_socialbookmarks/512/social_google_box.png',

        imgCls:'yourCSScls',


        //defines the element that wraps around the image
        autoEl: {
            tag: 'a',
            href: 'http://www.google.com',
            target: '_blank'

                   //add any other attributes to the 'a' tag as needed
        }
    });
});