Browse Source

KERNEL-12202 fix:setLoading改为loading

es6
treecat 2 years ago
parent
commit
5a70e82652
  1. 16
      demo/js/base/button/demo.button.js
  2. 4
      src/base/single/button/buttons/button.js

16
demo/js/base/button/demo.button.js

@ -12,9 +12,9 @@ Demo.Button = BI.inherit(BI.Widget, {
height: 30, height: 30,
handler() { handler() {
console.log("触发点击事件"); console.log("触发点击事件");
this.setLoading(); this.loading();
setTimeout(() => { setTimeout(() => {
this.setLoaded(); this.loaded();
}, 5 * 1000); }, 5 * 1000);
} }
}, { }, {
@ -305,9 +305,9 @@ Demo.Button = BI.inherit(BI.Widget, {
text: "带加载的按钮", text: "带加载的按钮",
handler() { handler() {
console.log("触发点击事件"); console.log("触发点击事件");
this.setLoading(); this.loading();
setTimeout(() => { setTimeout(() => {
this.setLoaded(); this.loaded();
}, 5 * 1000); }, 5 * 1000);
} }
}, { }, {
@ -316,9 +316,9 @@ Demo.Button = BI.inherit(BI.Widget, {
iconCls: "circle-close-font", iconCls: "circle-close-font",
handler() { handler() {
console.log("触发点击事件"); console.log("触发点击事件");
this.setLoading(); this.loading();
setTimeout(() => { setTimeout(() => {
this.setLoaded(); this.loaded();
}, 5 * 1000); }, 5 * 1000);
} }
}, { }, {
@ -328,9 +328,9 @@ Demo.Button = BI.inherit(BI.Widget, {
iconCls: "circle-close-font", iconCls: "circle-close-font",
handler() { handler() {
console.log("触发点击事件"); console.log("触发点击事件");
this.setLoading(); this.loading();
setTimeout(() => { setTimeout(() => {
this.setLoaded(); this.loaded();
}, 5 * 1000); }, 5 * 1000);
} }
}, { }, {

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

@ -183,7 +183,7 @@
return this._loading === undefined ? this.options.loading : this._loading; return this._loading === undefined ? this.options.loading : this._loading;
}, },
setLoading: function (loading) { loading: function (loading) {
this._loading = true; this._loading = true;
this.element.addClass("loading"); this.element.addClass("loading");
// loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls // loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls
@ -191,7 +191,7 @@
this.icon.setVisible(true); this.icon.setVisible(true);
}, },
setLoaded() { loaded() {
this._loading = false; this._loading = false;
this.element.removeClass("loading"); this.element.removeClass("loading");
this.icon.element.removeClass(loadingCls); this.icon.element.removeClass(loadingCls);

Loading…
Cancel
Save