From 50e0826515016a8c81f246748453cadca380d4b2 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 28 Jun 2019 17:16:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/button/buttons/button.js | 4 ---- src/core/wrapper/layout/flex/flex.center.js | 13 +++++++++++-- .../wrapper/layout/flex/flex.horizontal.center.js | 5 ----- .../wrapper/layout/flex/flex.vertical.center.js | 5 ----- .../layout/flex/wrapper/flex.wrapper.center.js | 8 +++++++- .../flex/wrapper/flex.wrapper.horizontal.center.js | 5 ----- .../flex/wrapper/flex.wrapper.vertical.center.js | 5 ----- 7 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index b3f6cf075..85ab78d06 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -66,10 +66,6 @@ BI.Button = BI.inherit(BI.BasicButton, { element: this, hgap: o.hgap, vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap, - lgap: o.lgap, - rgap: o.rgap, items: [{ type: "bi.horizontal", items: [this.icon, this.text] diff --git a/src/core/wrapper/layout/flex/flex.center.js b/src/core/wrapper/layout/flex/flex.center.js index f6073505e..add02edbb 100644 --- a/src/core/wrapper/layout/flex/flex.center.js +++ b/src/core/wrapper/layout/flex/flex.center.js @@ -8,7 +8,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-center-adapt-layout" + baseCls: "bi-flex-center-adapt-layout", + hgap: 0, + vgap: 0 }); }, render: function () { @@ -19,7 +21,14 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({position: "relative", "flex-shrink": "0"}); + w.element.css({ + position: "relative", + "flex-shrink": "0", + "margin-left": (i === 0 ? o.hgap : 0) + "px", + "margin-right": o.hgap + "px", + "margin-top": o.vgap + "px", + "margin-bottom": o.vgap + "px" + }); return w; }, diff --git a/src/core/wrapper/layout/flex/flex.horizontal.center.js b/src/core/wrapper/layout/flex/flex.horizontal.center.js index 602e4b8cc..6a06ed277 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.center.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.center.js @@ -33,11 +33,6 @@ BI.FlexHorizontalCenter = BI.inherit(BI.Layout, { scrolly: o.scrolly, scrollable: o.scrollable, hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, items: o.items }; }, diff --git a/src/core/wrapper/layout/flex/flex.vertical.center.js b/src/core/wrapper/layout/flex/flex.vertical.center.js index fea81ef49..e99c44853 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.center.js +++ b/src/core/wrapper/layout/flex/flex.vertical.center.js @@ -33,12 +33,7 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, { scrollx: o.scrollx, scrolly: o.scrolly, scrollable: o.scrollable, - hgap: o.hgap, vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, items: o.items }; }, diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js index 7ba06fe75..9be30ab8f 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js @@ -21,7 +21,13 @@ BI.FlexWrapperCenterLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({position: "relative"}); + w.element.css({ + position: "relative", + "margin-left": (i === 0 ? o.hgap : 0) + "px", + "margin-right": o.hgap + "px", + "margin-top": o.vgap + "px", + "margin-bottom": o.vgap + "px" + }); return w; }, diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js index 9a4d271eb..2f97dcd40 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js @@ -35,11 +35,6 @@ BI.FlexWrapperHorizontalCenter = BI.inherit(BI.Layout, { scrolly: o.scrolly, scrollable: o.scrollable, hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, items: o.items }; }, diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js index c5a6a029b..f4d2424c1 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js @@ -34,12 +34,7 @@ BI.FlexWrapperVerticalCenter = BI.inherit(BI.Layout, { scrollx: o.scrollx, scrolly: o.scrolly, scrollable: o.scrollable, - hgap: o.hgap, vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, items: o.items }; },