Browse Source

ddd8fcf - DESIGN-4069 fix: 删除了 iconSize 属性,增加了按钮的 loading 状态

es6
treecat 3 years ago
parent
commit
dceef8f14e
  1. 3
      demo/js/base/button/demo.button.js
  2. 30
      src/base/single/button/buttons/button.js

3
demo/js/base/button/demo.button.js

@ -216,8 +216,9 @@ Demo.Button = BI.inherit(BI.Widget, {
}, {
el: {
type: "bi.button",
text: "图标在上面的按钮",
text: "图标在上面的按钮,而且可以自动撑开高度",
iconCls: "close-font",
iconGap: 24,
iconPosition: "top"
}
}, {

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

@ -36,6 +36,7 @@
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, // 是否去掉边框和背景
ghost: false, // 是否幽灵显示, 即正常状态无背景
loading: false, // 是否处于加载中
textAlign: "center",
whiteSpace: "nowrap",
textWidth: null,
@ -46,9 +47,8 @@
bgap: 0,
lgap: 0,
rgap: 0,
iconGap: 4,
iconPosition: "left",
iconSize: props.iconSize
iconGap: 8,
iconPosition: "left"
});
},
@ -74,19 +74,12 @@
}
}
if (BI.isKey(o.iconCls)) {
var iconCss = {};
if (o.iconSize) {
iconCss.fontSize = o.iconSize / BI.pixRatio + BI.pixUnit;
}
this.icon = BI.createWidget({
type: "bi.icon_label",
cls: o.iconCls,
width: o.iconWidth,
height: o.iconHeight,
lineHeight: o.iconHeight,
iconWidth: o.iconSize,
iconHeight: o.iconSize,
css: iconCss
width: this._const.iconWidth,
height: lineHeight,
lineHeight: lineHeight
});
this.text = BI.createWidget({
type: "bi.label",
@ -150,6 +143,9 @@
if (o.ghost === true) {
this.element.addClass("ghost");
}
if (o.loading === true) {
this.element.addClass("loading");
}
if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit});
}
@ -171,6 +167,14 @@
}
},
setLoading: function (loading) {
if(loading) {
this.element.addClass("loading");
} else {
this.element.removeClass("loading");
}
},
setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text);

Loading…
Cancel
Save