fix(Layout): gutter calculation (#6197)
* Revert "fix(Layout): outside of the screen after setting gutter (#6143)"
This reverts commit a460425b26.
* fix(Layout): gutter calculation
* test: fix snapshot
This commit is contained in:
+6
-19
@@ -16,28 +16,15 @@ export default createComponent({
|
||||
},
|
||||
|
||||
computed: {
|
||||
gutter() {
|
||||
return (this.parent && Number(this.parent.gutter)) || 0;
|
||||
},
|
||||
|
||||
style() {
|
||||
const { index, gutter } = this;
|
||||
|
||||
if (gutter) {
|
||||
const count = this.parent.children.length;
|
||||
const padding = (gutter * (count - 1)) / count;
|
||||
|
||||
if (index === 0) {
|
||||
return { paddingRight: `${padding}px` };
|
||||
}
|
||||
|
||||
if (index === count - 1) {
|
||||
return { paddingLeft: `${padding}px` };
|
||||
}
|
||||
const { index } = this;
|
||||
const { spaces } = this.parent || {};
|
||||
|
||||
if (spaces && spaces[index]) {
|
||||
const { left, right } = spaces[index];
|
||||
return {
|
||||
paddingLeft: `${padding / 2}px`,
|
||||
paddingRight: `${padding / 2}px`,
|
||||
paddingLeft: left ? `${left}px` : null,
|
||||
paddingRight: right ? `${right}px` : null,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user