|
|
@ -30,12 +30,14 @@ |
|
|
|
adaptiveHeight += (tGap + bGap); |
|
|
|
adaptiveHeight += (tGap + bGap); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var clearMinWidth = props.block === true || props.clear === true || props.plain; |
|
|
|
|
|
|
|
|
|
|
|
return BI.extend(conf, { |
|
|
|
return BI.extend(conf, { |
|
|
|
baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""), |
|
|
|
baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""), |
|
|
|
attributes: { |
|
|
|
attributes: { |
|
|
|
tabIndex: 1 |
|
|
|
tabIndex: 1 |
|
|
|
}, |
|
|
|
}, |
|
|
|
minWidth: (props.block === true || props.clear === true) ? 0 : 80, |
|
|
|
minWidth: clearMinWidth ? 0 : 80, |
|
|
|
height: isVertical(props.iconPosition) ? adaptiveHeight : 24, |
|
|
|
height: isVertical(props.iconPosition) ? adaptiveHeight : 24, |
|
|
|
shadow: props.clear !== true, |
|
|
|
shadow: props.clear !== true, |
|
|
|
isShadowShowingOnSelected: true, |
|
|
|
isShadowShowingOnSelected: true, |
|
|
@ -64,7 +66,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options, self = this; |
|
|
|
|
|
|
|
|
|
|
|
// 由于button默认情况下有个边框,所以要主动算行高
|
|
|
|
// 由于button默认情况下有个边框,所以要主动算行高
|
|
|
|
var lineHeight, textHeight = o.textHeight; |
|
|
|
var lineHeight, textHeight = o.textHeight; |
|
|
@ -148,24 +150,14 @@ |
|
|
|
value: o.value |
|
|
|
value: o.value |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if (o.block === true) { |
|
|
|
var classArr = ["block", "clear", "ghost", "plain", "loading", "light"]; |
|
|
|
this.element.addClass("block"); |
|
|
|
// 如果 options 对应的属性为 true 则给元素添加 class
|
|
|
|
} |
|
|
|
BI.each(classArr, function (_, clz) { |
|
|
|
if (o.clear === true) { |
|
|
|
if (BI.get(o, clz) === true) { |
|
|
|
this.element.addClass("clear"); |
|
|
|
self.element.addClass(clz); |
|
|
|
} |
|
|
|
|
|
|
|
if (o.ghost === true) { |
|
|
|
|
|
|
|
this.element.addClass("ghost"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.plain === true) { |
|
|
|
|
|
|
|
this.element.addClass("plain"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.loading === true) { |
|
|
|
|
|
|
|
this.element.addClass("loading"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.light === true) { |
|
|
|
|
|
|
|
this.element.addClass("light"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (o.minWidth > 0) { |
|
|
|
if (o.minWidth > 0) { |
|
|
|
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit}); |
|
|
|
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit}); |
|
|
|
} |
|
|
|
} |
|
|
|