【问题标题】:ExtJS4 - autoEl width and height propertyExtJS4 - autoEl 宽度和高度属性
【发布时间】:2015-01-25 07:25:59
【问题描述】:

美好的一天,我正在使用 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'
            },

我的想法来自this jsfiddle example

但是,图像非常大,width 和 height 属性根本没有应用于图像。关于如何在具有 autoEl 属性的图像中指定宽度和高度的任何想法?

感谢任何帮助。谢谢。

【问题讨论】:

    标签: javascript extjs extjs4 extjs4.2


    【解决方案1】:

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

    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
            }
        });
    });
    

    希望对你有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-03
      • 1970-01-01
      • 2016-05-15
      • 2019-05-26
      • 1970-01-01
      相关资源
      最近更新 更多