Browse Source

KERNEL-9408 fix:修改其它框架实现图标的方式

es6
treecat 2 years ago
parent
commit
6895777066
  1. 6
      demo/js/base/button/demo.button.js
  2. 11
      src/base/single/button/buttons/button.js

6
demo/js/base/button/demo.button.js

@ -376,6 +376,12 @@ Demo.Button = BI.inherit(BI.Widget, {
this.loaded(); this.loaded();
}, 5 * 1000); }, 5 * 1000);
}, },
}, {
type: "bi.button",
text: "图标的实现交给其他框架",
icon(element) {
element.append("<span>🧙</span>");
},
}]; }];
return { return {

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

@ -91,15 +91,16 @@
} }
var iconInvisible = !o.loading && !o.iconCls; var iconInvisible = !o.loading && !o.iconCls;
if (BI.isObject(o.icon) && BI.isString(o.icon.type)) { if (BI.isPlainObject(o.icon)) {
// FineUI 自定义 icon
this.icon = BI.createWidget(o.icon); this.icon = BI.createWidget(o.icon);
o.loading ? (this.icon.loading && this.icon.loading()) o.loading ? (this.icon.loading && this.icon.loading())
: (this.icon.loaded && this.icon.loaded()); : (this.icon.loaded && this.icon.loaded());
} else { } else {
// ReactUI 自定义的 icon if (!o.loading && BI.isFunction(o.icon)) {
if (!o.loading && BI.isObject(o.icon)) { this.icon = BI.createWidget({
this.icon = o.icon; type: "bi.layout",
});
o.icon(this.icon.element);
} else { } else {
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.icon_label", type: "bi.icon_label",

Loading…
Cancel
Save