forked from fanruan/fineui
Young
6 years ago
14 changed files with 359 additions and 227 deletions
@ -0,0 +1,20 @@ |
|||||||
|
Demo.IconLabel = BI.inherit(BI.Widget, { |
||||||
|
props: { |
||||||
|
baseCls: "demo-bubble" |
||||||
|
}, |
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.default", |
||||||
|
items: [{ |
||||||
|
type: "bi.label", |
||||||
|
text: "这是一个icon标签,在加了border之后仍然是居中显示的" |
||||||
|
}, { |
||||||
|
type: "bi.icon_label", |
||||||
|
cls: "date-font bi-border", |
||||||
|
height: 40, |
||||||
|
width: 40 |
||||||
|
}] |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
BI.shortcut("demo.icon_label", Demo.IconLabel); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,42 @@ |
|||||||
|
/** |
||||||
|
* @class BI.IconButton |
||||||
|
* @extends BI.BasicButton |
||||||
|
* 图标标签 |
||||||
|
*/ |
||||||
|
BI.IconLabel = BI.inherit(BI.Single, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "bi-icon-label horizon-center", |
||||||
|
iconWidth: null, |
||||||
|
iconHeight: null |
||||||
|
}, |
||||||
|
|
||||||
|
_init: function () { |
||||||
|
BI.IconLabel.superclass._init.apply(this, arguments); |
||||||
|
var o = this.options; |
||||||
|
this.element.css({ |
||||||
|
textAlign: "center" |
||||||
|
}); |
||||||
|
this.icon = BI.createWidget({ |
||||||
|
type: "bi.icon", |
||||||
|
width: o.iconWidth, |
||||||
|
height: o.iconHeight |
||||||
|
}); |
||||||
|
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) { |
||||||
|
this.element.css("lineHeight", o.height + "px"); |
||||||
|
BI.createWidget({ |
||||||
|
type: "bi.default", |
||||||
|
element: this, |
||||||
|
items: [this.icon] |
||||||
|
}); |
||||||
|
} else { |
||||||
|
this.element.css("lineHeight", "1"); |
||||||
|
BI.createWidget({ |
||||||
|
element: this, |
||||||
|
type: "bi.center_adapt", |
||||||
|
items: [this.icon] |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
BI.shortcut("bi.icon_label", BI.IconLabel); |
Loading…
Reference in new issue