From ffa54ad6de6b255a775911118b1f9c94eb43bd18 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 12 Nov 2021 12:07:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=97=B4=E9=9A=99=E5=92=8C=E4=BB=AA=E8=A1=A8=E6=9D=BF=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E9=97=B4=E9=9A=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/index.vue | 15 +++++++------- .../components/Editor/ComponentWrapper.vue | 11 +++++++--- .../canvas/components/Editor/Preview.vue | 20 +++++-------------- .../canvas/components/Editor/index.vue | 3 ++- frontend/src/views/panel/edit/index.vue | 12 ++++++----- .../src/views/panel/list/PanelViewShow.vue | 2 +- 6 files changed, 31 insertions(+), 32 deletions(-) diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 5c2f32078b..49adf6b611 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -444,7 +444,7 @@ export default { style() { // console.log('style-top:' + this.y + '--' + this.top) return { - padding: (this.canvasStyleData.panel.gap === 'yes' ? this.componentGap : 0) + 'px', + padding: this.curGap + 'px', transform: `translate(${this.left}px, ${this.top}px) rotate(${this.rotate}deg)`, width: this.computedWidth, height: this.computedHeight, @@ -487,7 +487,6 @@ export default { // 根据left right 算出元素的宽度 computedMainSlotWidth() { - const gap = (this.canvasStyleData.panel.gap === 'yes' ? this.componentGap : 0) * 2 if (this.w === 'auto') { if (!this.widthTouched) { return 'auto' @@ -495,14 +494,13 @@ export default { } if (this.element.auxiliaryMatrix) { const width = Math.round(this.width / this.curCanvasScale.matrixStyleWidth) * this.curCanvasScale.matrixStyleWidth - return (width - gap) + 'px' + return (width - this.curGap * 2) + 'px' } else { - return (this.width - gap) + 'px' + return (this.width - this.curGap * 2) + 'px' } }, // 根据top bottom 算出元素的宽度 computedMainSlotHeight() { - const gap = (this.canvasStyleData.panel.gap === 'yes' ? this.componentGap : 0) * 2 if (this.h === 'auto') { if (!this.heightTouched) { return 'auto' @@ -510,9 +508,9 @@ export default { } if (this.element.auxiliaryMatrix) { const height = Math.round(this.height / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight - return (height - gap) + 'px' + return (height - this.curGap * 2) + 'px' } else { - return (this.height - gap) + 'px' + return (this.height - this.curGap * 2) + 'px' } }, @@ -528,6 +526,9 @@ export default { curComponent() { return this.$store.state.curComponent }, + curGap() { + return this.canvasStyleData.panel.gap === 'yes' && this.element.auxiliaryMatrix ? this.componentGap : 0 + }, ...mapState([ 'editor', 'curCanvasScale', diff --git a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue index 3d0b764a8e..84acd7331f 100644 --- a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue @@ -1,7 +1,6 @@