Browse Source

Merge pull request #79719 in DEC/fineui from master to feature/x

* commit '786c1b432cad432c68c0eff8600572ea50157e55':
  DESIGN-4069 fix: button 的 setIcon 不使用 IconChangeButton
  DESIGN-4069 feat: button 增加 setIcon 属性
es6
superman 3 years ago
parent
commit
2a8e22e354
  1. 15
      demo/js/base/button/demo.button.js
  2. 8
      src/base/single/button/buttons/button.js

15
demo/js/base/button/demo.button.js

@ -376,6 +376,21 @@ Demo.Button = BI.inherit(BI.Widget, {
plain: true, plain: true,
disabled: true disabled: true
} }
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "点我,更改图标",
handler() {
this.i = this.i === undefined ? 0 : ++this.i;
const arr = ["text-background-font", "check-mark-ha-font", "close-font", "search-font", "date-change-h-font"];
if(this.i >= arr.length) {
this.i = 0;
}
this.setIcon(arr[this.i]);
},
height: 24
}
}]; }];
// BI.each(items, function (i, item) { // BI.each(items, function (i, item) {
// item.el.handler = function () { // item.el.handler = function () {

8
src/base/single/button/buttons/button.js

@ -195,6 +195,14 @@
} }
}, },
setIcon: function (cls) {
var o = this.options;
if(this.icon && o.iconCls !== cls) {
this.icon.element.removeClass(o.iconCls).addClass(cls);
o.iconCls = cls;
}
},
doRedMark: function () { doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark.apply(this.text, arguments);
}, },

Loading…
Cancel
Save