javascript - ext.js 5.0.0 图片按钮

标签 javascript css extjs extjs5

是否可以在 ext.js 5.0.0 中覆盖所有状态下的按钮背景图像:正常、悬停、按下?我尝试使用以下 css 代码但没有成功:

.fieldNameCls
{

}

.fieldDataCls
{

}

.x-btn.removeButtonCls {
  width: 26px;
  height: 26px;
//  background-color: transparent !important;
  background: url('images/RemoveDetailButton.png') no-repeat;
  background-size: contain !important;
  border-style: none !important;
  border-radius: 0px !important;
}

.x-btn-over.removeButtonCls {
  width: 26px;
  height: 26px;
  background: url('images/RemoveDetailButtonHover.png') no-repeat;
  background-size: contain !important;
  border-style: none !important;
  border-radius: 0px !important;
}

.x-btn-pressed.removeButtonCls {
  width: 26px;
  height: 26px;
  background: url('images/RemoveDetailButtonPressed.png') no-repeat;
  background-size: contain !important;
  border-style: none !important;
  border-radius: 0px !important;
}

js按钮定义如下:

{
    xtype: 'button',
    itemId: 'removeButton',
    cls: 'removeButtonCls',
    // style: 'background:url("resources/images/RemoveDetailButton.png") no-repeat; background-size: 100% !important; border-style: none !important;border-radius: 0px !important;',
    // style: 'background:none !important; border-style: none !important;border-radius: 0px !important;',
    margin: '10 10 0 0'
}

我试图了解要覆盖哪些类,但无法理解 Ext.js 每个按钮使用的所有 div/span...;)

我是否应该只使用一些 HTML 按钮来代替,它会更容易覆盖,但作为 Web 设计的新手,我不确定我将如何从该按钮获取事件/更改文本 ...

谢谢

最佳答案

一旦你知道怎么做,就很容易了:)

在 Ext.js 中:

{
    xtype: 'button',
    itemId: 'removeButton',
    baseCls: 'removeButtonCls',
    margin: '10 10 0 0'
}

在 CSS 中:

.removeButtonCls {
  width: 26px;
  height: 26px;
  //  background-color: transparent !important;
  background: url('images/RemoveDetailButton.png') no-repeat;
  background-size: contain !important;
  border-style: none !important;
  border-radius: 0px !important;
}

.removeButtonCls :hover {
  width: 26px;
  height: 26px;
  //  background-color: transparent !important;
  background: url('images/RemoveDetailButtonHover.png') no-repeat;
  background-size: contain !important;
  border-style: none !important;
  border-radius: 0px !important;
}

.removeButtonCls :active {
  width: 26px;
  height: 26px;
  //  background-color: transparent !important;
  background: url('images/RemoveDetailButtonPressed.png') no-repeat;
  background-size: contain !important;
  border-style: none !important;
  border-radius: 0px !important;
}

就这么简单..

关于javascript - ext.js 5.0.0 图片按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24606325/

相关文章:

ExtJS 在表单中对齐单选组

html - 使用纯 CSS(HTML 列表)将其他子项的属性悬停在同一父项下

html - Bootstrap 将头部卡住在 table 上

javascript - extjs 4.1.0 Controller 的 init 函数不会被调用

asp.net - Ajax 数据更新。扩展程序

css - Vuetify v-btn 水平向右

javascript - 如何比较两个输入值(文本和复选框)并输出结果

javascript - 使用 lodash 模板,如何检查变量是否存在?

Javascript:使用额外的花括号解析 JSON

javascript - Ckeditor 初始禁用小部件按钮状态