From bca491cd98f92e7f25e5362b14adef2d1b5517f9 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 6 Mar 2024 17:49:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=8B=A9=E9=A6=96=E9=80=89=E9=A1=B9=E7=9A=84?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6=E5=9C=A8tab=E4=B8=AD?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=87=BA=E7=8E=B0=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/editor/Preview.vue | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/core/frontend/src/components/canvas/components/editor/Preview.vue b/core/frontend/src/components/canvas/components/editor/Preview.vue index e53ae89723..e8202bb816 100644 --- a/core/frontend/src/components/canvas/components/editor/Preview.vue +++ b/core/frontend/src/components/canvas/components/editor/Preview.vue @@ -794,6 +794,7 @@ export default { restore() { const canvasHeight = document.getElementById(this.previewDomId).offsetHeight const canvasWidth = document.getElementById(this.previewDomId).offsetWidth + console.log('===canvasHeight=' + canvasHeight + ';canvasWidth=' + canvasWidth) this.scaleWidth = (canvasWidth) * 100 / this.canvasStyleData.width // 获取宽度比 // 如果是后端截图方式使用 的高度伸缩比例和宽度比例相同 if (this.backScreenShot) { @@ -828,25 +829,30 @@ export default { if (this.componentData) { const componentData = deepCopy(this.componentData) componentData.forEach(component => { - Object.keys(component.style).forEach(key => { - if (this.needToChangeHeight.includes(key)) { - component.style[key] = this.format(component.style[key], this.scaleHeight) - } - if (this.needToChangeWidth.includes(key)) { - component.style[key] = this.format(component.style[key], this.scaleWidth) - } - if (this.needToChangeInnerWidth.includes(key)) { - if ((key === 'fontSize' || key === 'activeFontSize') && (this.terminal === 'mobile' || ['custom'].includes(component.type))) { - // do nothing 移动端字符大小无需按照比例缩放,当前保持不变(包括 v-text 和 过滤组件) - } else { - if (key === 'fontSize' && component.component !== 'de-tabs') { - component.style[key] = this.formatPoint(component.style[key], this.previewCanvasScale.scalePointWidth * 1.4) + if (!this.isMainCanvas() && component.type === 'custom' && component.options?.attrs?.selectFirst && this.format(component.style.width, this.scaleWidth) < 80) { + // do continue + } else { + Object.keys(component.style).forEach(key => { + if (this.needToChangeHeight.includes(key)) { + component.style[key] = this.format(component.style[key], this.scaleHeight) + } + if (this.needToChangeWidth.includes(key)) { + component.style[key] = this.format(component.style[key], this.scaleWidth) + } + if (this.needToChangeInnerWidth.includes(key)) { + if ((key === 'fontSize' || key === 'activeFontSize') && (this.terminal === 'mobile' || ['custom'].includes(component.type))) { + // do nothing 移动端字符大小无需按照比例缩放,当前保持不变(包括 v-text 和 过滤组件) } else { - component.style[key] = this.formatPoint(component.style[key], this.previewCanvasScale.scalePointWidth) + if (key === 'fontSize' && component.component !== 'de-tabs') { + component.style[key] = this.formatPoint(component.style[key], this.previewCanvasScale.scalePointWidth * 1.4) + } else { + component.style[key] = this.formatPoint(component.style[key], this.previewCanvasScale.scalePointWidth) + } } } - } - }) + }) + } + const maxWidth = this.canvasStyleData.width * this.scaleWidth / 100 if (component.style['width'] > maxWidth) { component.style['width'] = maxWidth