diff --git a/demo/js/base/button/demo.button.js b/demo/js/base/button/demo.button.js index 420a47d77..39b27b716 100644 --- a/demo/js/base/button/demo.button.js +++ b/demo/js/base/button/demo.button.js @@ -376,6 +376,12 @@ Demo.Button = BI.inherit(BI.Widget, { this.loaded(); }, 5 * 1000); }, + }, { + type: "bi.button", + text: "图标的实现交给其他框架", + icon(element) { + element.append("🧙"); + }, }]; return { diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index d15051be5..f9aa8586e 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -91,15 +91,16 @@ } var iconInvisible = !o.loading && !o.iconCls; - if (BI.isObject(o.icon) && BI.isString(o.icon.type)) { - // FineUI 自定义 icon + if (BI.isPlainObject(o.icon)) { this.icon = BI.createWidget(o.icon); o.loading ? (this.icon.loading && this.icon.loading()) : (this.icon.loaded && this.icon.loaded()); } else { - // ReactUI 自定义的 icon - if (!o.loading && BI.isObject(o.icon)) { - this.icon = o.icon; + if (!o.loading && BI.isFunction(o.icon)) { + this.icon = BI.createWidget({ + type: "bi.layout", + }); + o.icon(this.icon.element); } else { this.icon = BI.createWidget({ type: "bi.icon_label",