如何让ExtJS的按钮背景图片在Extjs 2.3中正确显示

问题描述 投票:0回答:1

我知道 Extjs 2.3 已经很老了,但我正在接管某人的工作。所以我现在束手无策。

好吧,我应该更改界面中的一些内容并添加新功能。 这是我第一个真正的 ExtJS 作品(这里是 jquery boy)。

我想在按钮上添加新图标,但似乎我什至无法正确显示图像,因为我无法影响按钮的高度,无论是在按钮对象属性上还是在 css 中。 我所做的就是影响按钮的宽度。

这是我的尝试

  btntelButton = new Ext.Button({
            name: 'telbtn',
            id: 'btntel',
            cls : 'x-btn-icon',
            iconCls: 'telButton',
            minWidth : 95,
        });
    <style type="text/css">
       .telButton
        {
            height: 60px;
             background-image: url(images/tel.png) !important;
        }
    </style>

使用 telButton 类,背景图像会出现,但会调整为最小尺寸,仅显示图像的一小部分showing here 当我使用按钮本身的样式时

    //...
    id: 'btntel',
    cls : 'x-btn-icon',
    style: {height: '90px'}
    //...

这是节目this 在过去的几个小时里我一直在拉我的头发。你们 Extjs 人会怎么做呢? 请说明这一点。感谢您的阅读

javascript extjs javascript-framework
1个回答
0
投票

您可以直接向按钮添加样式

例如:

style:{height:'60px'}

第二个想法是将你的 css 类声明为:

 .telButton
  {
      height: 60px;
      background-image: url(images/tel.png) !important;
  }

而不是-->button.telButton(不确定它是否会有任何区别)

© www.soinside.com 2019 - 2024. All rights reserved.