From 5a70e82652dea1c9abde7f434bdf9025a81a8be7 Mon Sep 17 00:00:00 2001 From: treecat Date: Wed, 27 Jul 2022 18:31:47 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-12202=20fix:setLoading=E6=94=B9=E4=B8=BA?= =?UTF-8?q?loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/base/button/demo.button.js | 16 ++++++++-------- src/base/single/button/buttons/button.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/demo/js/base/button/demo.button.js b/demo/js/base/button/demo.button.js index c69e01167..1f2eeec0a 100644 --- a/demo/js/base/button/demo.button.js +++ b/demo/js/base/button/demo.button.js @@ -12,9 +12,9 @@ Demo.Button = BI.inherit(BI.Widget, { height: 30, handler() { console.log("触发点击事件"); - this.setLoading(); + this.loading(); setTimeout(() => { - this.setLoaded(); + this.loaded(); }, 5 * 1000); } }, { @@ -305,9 +305,9 @@ Demo.Button = BI.inherit(BI.Widget, { text: "带加载的按钮", handler() { console.log("触发点击事件"); - this.setLoading(); + this.loading(); setTimeout(() => { - this.setLoaded(); + this.loaded(); }, 5 * 1000); } }, { @@ -316,9 +316,9 @@ Demo.Button = BI.inherit(BI.Widget, { iconCls: "circle-close-font", handler() { console.log("触发点击事件"); - this.setLoading(); + this.loading(); setTimeout(() => { - this.setLoaded(); + this.loaded(); }, 5 * 1000); } }, { @@ -328,9 +328,9 @@ Demo.Button = BI.inherit(BI.Widget, { iconCls: "circle-close-font", handler() { console.log("触发点击事件"); - this.setLoading(); + this.loading(); setTimeout(() => { - this.setLoaded(); + this.loaded(); }, 5 * 1000); } }, { diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 778ecfe74..8f46112ca 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -183,7 +183,7 @@ return this._loading === undefined ? this.options.loading : this._loading; }, - setLoading: function (loading) { + loading: function (loading) { this._loading = true; this.element.addClass("loading"); // loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls @@ -191,7 +191,7 @@ this.icon.setVisible(true); }, - setLoaded() { + loaded() { this._loading = false; this.element.removeClass("loading"); this.icon.element.removeClass(loadingCls);