Commit 8f38572b authored by Xuguangxing's avatar Xuguangxing

feat: 处理高度和内间距的关系

parent db7ff7cd
......@@ -335,10 +335,11 @@ export default class DynamicForm extends Mixins(ContextMenuMixin, DynamicFormMix
}
changeMargin() {
const ele = this.getCurElement();
const prevCommonStyle = cloneDeep(ele.commonStyle || {});
// this.point.w = this.point.w - (this.commonStyle.paddingLeft || 0) - (this.commonStyle.paddingRight || 0);
this.point.h = this.point.h - (this.prevCommonStyle.paddingTop || 0) - (this.prevCommonStyle.paddingBottom || 0) + (this.commonStyle.paddingTop || 0) + (this.commonStyle.paddingBottom || 0);
this.point.h = this.point.h - (prevCommonStyle.paddingTop || 0) - (prevCommonStyle.paddingBottom || 0) + (this.commonStyle.paddingTop || 0) + (this.commonStyle.paddingBottom || 0);
this.updateCommonStyle({ containerIndex: this.curEleIndex, childIndex: this.curChildIndex, data: this.commonStyle });
this.prevCommonStyle = cloneDeep(this.commonStyle);
this.updatePoint();
// this.adjustHeight();
}
......
......@@ -37,7 +37,9 @@ export default class ContextMenuMixin extends Vue {
const elements = this.pageData.elements[this.curEleIndex];
const component = document.getElementById(elements.id);
const height = component ? getStyle(component, 'height') : 0;
console.log('adjustHeight', height);
this.updatePageInfo({ containerIndex: this.curEleIndex, data: { ...elements, point: { ...elements.point, h: Math.ceil(+height || elements.point.h) } } });
const paddingTop = elements.commonStyle.paddingTop || 0;
const paddingBottom = elements.commonStyle.paddingBottom || 0;
console.log('adjustHeight', height, elements.commonStyle);
this.updatePageInfo({ containerIndex: this.curEleIndex, data: { ...elements, point: { ...elements.point, h: Math.ceil((+height || elements.point.h) + paddingTop + paddingBottom) } } });
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment