diff --git a/demo/js/case/demo.segment.js b/demo/js/case/demo.segment.js index 8831c11f3..f6b2b0068 100644 --- a/demo/js/case/demo.segment.js +++ b/demo/js/case/demo.segment.js @@ -5,20 +5,20 @@ Demo.Func = BI.inherit(BI.Widget, { render: function () { BI.createWidget({ - type: "bi.vertical", + type: "bi.horizontal", element: this, vgap: 20, hgap: 30, items: [{ type: "bi.segment", items: [{ - text: "1", + text: "较长的选项1", value: 1 }, { - text: "2", + text: "选项2", value: 2 }, { - text: "3", + text: "选项3", value: 3 }] }] diff --git a/src/case/segment/segment.js b/src/case/segment/segment.js index dac7754d1..ef52ae24a 100644 --- a/src/case/segment/segment.js +++ b/src/case/segment/segment.js @@ -23,13 +23,12 @@ BI.Segment = BI.inherit(BI.Widget, { items: BI.createItems(o.items, { type: "bi.segment_button", height: BI.toPix(o.height, 2), - whiteSpace: o.whiteSpace + whiteSpace: o.whiteSpace, }), - layout: [ - { - type: "bi.center" - } - ] + layouts: o.layouts || [{ + type: "bi.table", + columnSize: BI.makeArrayByArray(o.items, "fill"), + }], }); this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/less/base/segment/segment.less b/src/less/base/segment/segment.less index 69aa01dbc..74ffe2f16 100644 --- a/src/less/base/segment/segment.less +++ b/src/less/base/segment/segment.less @@ -7,7 +7,7 @@ border-top: 1px solid @color-bi-split-segment; border-bottom: 1px solid @color-bi-split-segment; } - & > .first-element{ + & > .first-element, & > .first-row{ border-left: 1px solid @color-bi-split-segment; .border-corner-radius(2px,0px,0px,2px) }