From 292895508b32523b4af0af0939bf5630d7d90365 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 3 Dec 2021 17:35:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BFpdf=E6=88=AA=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/components/Editor/Preview.vue | 5 ++++- frontend/src/views/panel/export/PDFPreExport.vue | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/Preview.vue b/frontend/src/components/canvas/components/Editor/Preview.vue index 07db29246d..2dbc6c18d3 100644 --- a/frontend/src/components/canvas/components/Editor/Preview.vue +++ b/frontend/src/components/canvas/components/Editor/Preview.vue @@ -108,7 +108,9 @@ export default { }, computed: { customStyle() { - let style = {} + let style = { + width: '100%' + } if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { @@ -266,6 +268,7 @@ export default { .main-class { width: 100%; height: 100%; + background-size: 100% 100% !important; } .custom-position { diff --git a/frontend/src/views/panel/export/PDFPreExport.vue b/frontend/src/views/panel/export/PDFPreExport.vue index f5fcf1a382..99f410c3bf 100644 --- a/frontend/src/views/panel/export/PDFPreExport.vue +++ b/frontend/src/views/panel/export/PDFPreExport.vue @@ -97,7 +97,8 @@ export default { const contentWidth = canvas.width const contentHeight = canvas.height const pageData = canvas.toDataURL('image/jpeg', 1.0) - const PDF = new JsPDF('p', 'pt', [contentWidth, contentHeight]) + const lp = contentWidth > contentHeight ? 'l' : 'p' + const PDF = new JsPDF(lp, 'pt', [contentWidth, contentHeight]) PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight) PDF.save(_this.panelName + '.pdf') _this.$emit('closePreExport')