Browse Source

Pull request #2855: DESIGN-4069 feat: button 增加 setIcon 属性

Merge in VISUAL/fineui from ~TREECAT/fineui:master to master

* commit '0e4efcc66f94279b659fbae7cb4ad5b95a98c00c':
  DESIGN-4069 fix: button 的 setIcon 不使用 IconChangeButton
  DESIGN-4069 feat: button 增加 setIcon 属性
es6
treecat 3 years ago
parent
commit
786c1b432c
  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,
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) {
// 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 () {
this.text.doRedMark.apply(this.text, arguments);
},

Loading…
Cancel
Save