From 6895777066f3f522075255eac5c8ca0ef539dac1 Mon Sep 17 00:00:00 2001 From: treecat Date: Tue, 16 Aug 2022 16:35:29 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-9408=20fix:=E4=BF=AE=E6=94=B9=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E6=A1=86=E6=9E=B6=E5=AE=9E=E7=8E=B0=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/base/button/demo.button.js | 6 ++++++ src/base/single/button/buttons/button.js | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) 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",